Service
extends CatalogService
in package
The Networking class represents the OpenNetwork Neutron service.
Neutron is a service that provides networking between devices managed by other OpenNetwork services (e.g. Compute).
Table of Contents
- DEFAULT_NAME = 'cloudNetworks'
- DEFAULT_TYPE = 'network'
- DEFAULT_URL_TYPE = 'publicURL'
- PATCH_CONTENT_TYPE = OpenCloudCommonConstantsMime::JSON_PATCH
- SUPPORTED_VERSION = 'v2.0'
- $aliases : array<string|int, mixed>
- The aliases configure for the properties of the instance.
- $client : Client
- $endpoint : Endpoint
- $namespaces : array<string|int, mixed>
- $regionless : bool
- $resources : array<string|int, mixed>
- $logger : LoggerInterface
- The logger instance
- $name : string
- $properties : array<string|int, mixed>
- Holds all the properties added by overloading.
- $region : string
- $type : string
- $urlType : string
- __call() : mixed
- Intercept non-existent method calls for dynamic getter/setter functionality.
- __construct() : mixed
- Creates a service object, based off the specified client.
- checkJsonError() : mixed
- Checks the most recent JSON operation for errors.
- collection() : mixed
- createNetwork() : Network
- Creates a new Network and returns it.
- createNetworks() : PaginatedIterator
- Creates multiple new Networks and returns their list.
- createPort() : Port
- Creates a new Port and returns it.
- createPorts() : PaginatedIterator
- Creates multiple new Ports and returns their list.
- createSecurityGroup() : SecurityGroup
- Creates a new SecurityGroup and returns it.
- createSecurityGroupRule() : SecurityGroupRule
- Creates a new SecurityGroupRule and returns it.
- createSubnet() : Subnet
- Creates a new Subnet and returns it.
- createSubnets() : PaginatedIterator
- Creates multiple new Subnets and returns their list.
- generateUuid() : mixed
- getBaseUrl() : Url
- Get the base URL for this service, based on the set URL type.
- getClient() : Client
- getEndpoint() : Endpoint
- getExtensions() : array<string|int, mixed>
- Returns the /extensions for the service
- getInstance() : static
- getLogger() : LoggerInterface
- Returns the Logger object.
- getName() : string
- getNamespaces() : array<string|int, mixed>
- Returns a list of supported namespaces
- getNetwork() : Network
- Returns a Network object associated with this Networking service
- getPort() : Port
- Returns a Port object associated with this Networking service
- getRegion() : string
- getResources() : array<string|int, mixed>
- Get all associated resources for this service.
- getSecurityGroup() : SecurityGroup
- Returns a SecurityGroup object associated with this Networking service
- getSecurityGroupRule() : SecurityGroupRule
- Returns a SecurityGroupRule object associated with this Networking service
- getSubnet() : Subnet
- Returns a Subnet object associated with this Networking service
- getType() : string
- getUrl() : Url
- Returns the URL for the Service
- getUrlType() : string
- hasLogger() : bool
- limits() : array<string|int, mixed>
- Returns the limits for the service
- listNetworks() : PaginatedIterator
- Returns a list of networks you created
- listPorts() : PaginatedIterator
- Returns a list of ports you created
- listSecurityGroupRules() : PaginatedIterator
- Returns a list of security group rules you created
- listSecurityGroups() : PaginatedIterator
- Returns a list of security groups you created
- listSubnets() : PaginatedIterator
- Returns a list of subnets you created
- makeResourceIteratorOptions() : mixed
- name() : mixed
- namespaces() : array<string|int, mixed>
- Return namespaces.
- network() : Network
- Returns a Network object associated with this Networking service
- populate() : mixed
- Populates the current object based on an unknown data type.
- port() : Port
- Returns a Port object associated with this Networking service
- region() : mixed
- resource() : object
- Factory method for instantiating resource objects.
- resourceList() : PaginatedIterator
- Factory method for instantiating a resource collection.
- securityGroup() : SecurityGroup
- Returns a SecurityGroup object associated with this Networking service
- securityGroupRule() : SecurityGroupRule
- Returns a SecurityGroupRule object associated with this Networking service
- setClient() : mixed
- setEndpoint() : mixed
- setLogger() : $this
- Sets the logger.
- stripNamespace() : mixed
- subnet() : Subnet
- Returns a Subnet object associated with this Networking service
- toCamel() : mixed
- Convert a string to camelCase format.
- toUnderscores() : mixed
- Convert string to underscore format.
- url() : mixed
- getCurrentNamespace() : type
- Internal method for accessing child namespace from parent scope.
- getJsonHeader() : mixed
- getPatchHeaders() : mixed
- getProperty() : mixed
- Grab value out of the data array.
- propertyExists() : bool
- Basic check to see whether property exists.
- resolveResourceClass() : string
- Resolves FQCN for local resource.
- setProperty() : mixed
- We can set a property under three conditions:
- checkAttributePrefix() : bool
- Checks the attribute $property and only permits it if the prefix is in the specified $prefixes array
- findEndpoint() : Endpoint
- Extracts the appropriate endpoint from the service catalog based on the name and type of a service, and sets for further use.
- getMetaUrl() : stdClass
- Constructs a specified URL from the subresource
- isAccessible() : bool
- Does the property exist in the object variable list (i.e. does it have public or protected visibility?)
Constants
DEFAULT_NAME
public
mixed
DEFAULT_NAME
= 'cloudNetworks'
DEFAULT_TYPE
public
mixed
DEFAULT_TYPE
= 'network'
DEFAULT_URL_TYPE
public
mixed
DEFAULT_URL_TYPE
= 'publicURL'
PATCH_CONTENT_TYPE
public
mixed
PATCH_CONTENT_TYPE
= OpenCloudCommonConstantsMime::JSON_PATCH
SUPPORTED_VERSION
public
mixed
SUPPORTED_VERSION
= 'v2.0'
Properties
$aliases
The aliases configure for the properties of the instance.
protected
array<string|int, mixed>
$aliases
= array()
$client
protected
Client
$client
The client which interacts with the API.
$endpoint
protected
Endpoint
$endpoint
The endpoint for this service.
$namespaces
protected
array<string|int, mixed>
$namespaces
= array()
Namespaces for this service.
$regionless
protected
bool
$regionless
= false
Indicates whether a service is "regionless" or not. Defaults to FALSE because nearly all services are region-specific.
$resources
protected
array<string|int, mixed>
$resources
= array()
A collection of resource models that this service has control over.
$logger
The logger instance
private
LoggerInterface
$logger
$name
private
string
$name
The name of this service, as set in Catalog.
$properties
Holds all the properties added by overloading.
private
array<string|int, mixed>
$properties
= array()
$region
private
string
$region
The chosen region(s) for this service.
$type
private
string
$type
The type of this service, as set in Catalog.
$urlType
private
string
$urlType
Either 'publicURL' or 'internalURL'.
Methods
__call()
Intercept non-existent method calls for dynamic getter/setter functionality.
public
__call( $method, $args) : mixed
Parameters
Tags
Return values
mixed —__construct()
Creates a service object, based off the specified client.
public
__construct(Client $client[, string $type = null ][, string $name = null ][, string $region = null ][, string $urlType = null ]) : mixed
The service's URL is defined in the client's serviceCatalog; it uses the $type, $name, $region, and $urlType to find the proper endpoint and set it. If it cannot find a URL in the service catalog that matches the criteria, then an exception is thrown.
Parameters
- $client : Client
-
Client object
- $type : string = null
-
Service type (e.g. 'compute')
- $name : string = null
-
Service name (e.g. 'cloudServersOpenStack')
- $region : string = null
-
Service region (e.g. 'DFW', 'ORD', 'IAD', 'LON', 'SYD' or 'HKG')
- $urlType : string = null
-
Either 'publicURL' or 'internalURL'
Return values
mixed —checkJsonError()
Checks the most recent JSON operation for errors.
public
static checkJsonError() : mixed
Tags
Return values
mixed —collection()
public
collection(mixed $class[, mixed $url = null ][, mixed $parent = null ][, mixed $data = null ]) : mixed
Parameters
- $class : mixed
- $url : mixed = null
- $parent : mixed = null
- $data : mixed = null
Tags
Return values
mixed —createNetwork()
Creates a new Network and returns it.
public
createNetwork([array<string|int, mixed> $params = array() ]) : Network
Parameters
- $params : array<string|int, mixed> = array()
-
Network creation parameters.
Tags
Return values
Network —Object representing created network
createNetworks()
Creates multiple new Networks and returns their list.
public
createNetworks([array<string|int, mixed> $networksParams = array() ]) : PaginatedIterator
Parameters
- $networksParams : array<string|int, mixed> = array()
-
Array of network creation parameters' arrays
Return values
PaginatedIterator —createPort()
Creates a new Port and returns it.
public
createPort([array<string|int, mixed> $params = array() ]) : Port
Parameters
- $params : array<string|int, mixed> = array()
-
Port creation parameters.
Tags
Return values
Port —Object representing created port
createPorts()
Creates multiple new Ports and returns their list.
public
createPorts([array<string|int, mixed> $portsParams = array() ]) : PaginatedIterator
Parameters
- $portsParams : array<string|int, mixed> = array()
-
Array of port creation parameters' arrays
Return values
PaginatedIterator —createSecurityGroup()
Creates a new SecurityGroup and returns it.
public
createSecurityGroup([array<string|int, mixed> $params = array() ]) : SecurityGroup
Parameters
- $params : array<string|int, mixed> = array()
-
SecurityGroup creation parameters.
Tags
Return values
SecurityGroup —Object representing created security group
createSecurityGroupRule()
Creates a new SecurityGroupRule and returns it.
public
createSecurityGroupRule([array<string|int, mixed> $params = array() ]) : SecurityGroupRule
Parameters
- $params : array<string|int, mixed> = array()
-
SecurityGroupRule creation parameters.
Tags
Return values
SecurityGroupRule —Object representing created security group rule
createSubnet()
Creates a new Subnet and returns it.
public
createSubnet([array<string|int, mixed> $params = array() ]) : Subnet
Parameters
- $params : array<string|int, mixed> = array()
-
Subnet creation parameters.
Tags
Return values
Subnet —Object representing created subnet
createSubnets()
Creates multiple new Subnets and returns their list.
public
createSubnets([array<string|int, mixed> $subnetsParams = array() ]) : PaginatedIterator
Parameters
- $subnetsParams : array<string|int, mixed> = array()
-
Array of subnet creation parameters' arrays
Return values
PaginatedIterator —generateUuid()
public
static generateUuid() : mixed
Return values
mixed —getBaseUrl()
Get the base URL for this service, based on the set URL type.
public
getBaseUrl() : Url
Tags
Return values
Url —getClient()
public
getClient() : Client
Return values
Client —getEndpoint()
public
getEndpoint() : Endpoint
Return values
Endpoint —getExtensions()
Returns the /extensions for the service
public
getExtensions() : array<string|int, mixed>
Return values
array<string|int, mixed> —of objects
getInstance()
public
static getInstance() : static
Return values
static —getLogger()
Returns the Logger object.
public
getLogger() : LoggerInterface
Return values
LoggerInterface —getName()
public
getName() : string
Return values
string —getNamespaces()
Returns a list of supported namespaces
public
getNamespaces() : array<string|int, mixed>
Return values
array<string|int, mixed> —getNetwork()
Returns a Network object associated with this Networking service
public
getNetwork(string $id) : Network
Parameters
- $id : string
-
ID of network to retrieve
Return values
Network —object
getPort()
Returns a Port object associated with this Networking service
public
getPort(string $id) : Port
Parameters
- $id : string
-
ID of port to retrieve
Return values
Port —object
getRegion()
public
getRegion() : string
Return values
string —getResources()
Get all associated resources for this service.
public
getResources() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getSecurityGroup()
Returns a SecurityGroup object associated with this Networking service
public
getSecurityGroup(string $id) : SecurityGroup
Parameters
- $id : string
-
ID of security group to retrieve
Return values
SecurityGroup —object
getSecurityGroupRule()
Returns a SecurityGroupRule object associated with this Networking service
public
getSecurityGroupRule(string $id) : SecurityGroupRule
Parameters
- $id : string
-
ID of security group rule to retrieve
Return values
SecurityGroupRule —object
getSubnet()
Returns a Subnet object associated with this Networking service
public
getSubnet(string $id) : Subnet
Parameters
- $id : string
-
ID of subnet to retrieve
Return values
Subnet —object
getType()
public
getType() : string
Return values
string —getUrl()
Returns the URL for the Service
public
getUrl([string $path = null ][, array<string|int, mixed> $query = array() ]) : Url
Parameters
- $path : string = null
-
URL path segment
- $query : array<string|int, mixed> = array()
-
Array of query pairs
Return values
Url —getUrlType()
public
getUrlType() : string
Return values
string —hasLogger()
public
hasLogger() : bool
Return values
bool —limits()
Returns the limits for the service
public
limits() : array<string|int, mixed>
Return values
array<string|int, mixed> —of limits
listNetworks()
Returns a list of networks you created
public
listNetworks([array<string|int, mixed> $params = array() ]) : PaginatedIterator
Parameters
- $params : array<string|int, mixed> = array()
Return values
PaginatedIterator —listPorts()
Returns a list of ports you created
public
listPorts([array<string|int, mixed> $params = array() ]) : PaginatedIterator
Parameters
- $params : array<string|int, mixed> = array()
Return values
PaginatedIterator —listSecurityGroupRules()
Returns a list of security group rules you created
public
listSecurityGroupRules([array<string|int, mixed> $params = array() ]) : PaginatedIterator
Parameters
- $params : array<string|int, mixed> = array()
Return values
PaginatedIterator —listSecurityGroups()
Returns a list of security groups you created
public
listSecurityGroups([array<string|int, mixed> $params = array() ]) : PaginatedIterator
Parameters
- $params : array<string|int, mixed> = array()
Return values
PaginatedIterator —listSubnets()
Returns a list of subnets you created
public
listSubnets([array<string|int, mixed> $params = array() ]) : PaginatedIterator
Parameters
- $params : array<string|int, mixed> = array()
Return values
PaginatedIterator —makeResourceIteratorOptions()
public
makeResourceIteratorOptions(mixed $resource) : mixed
Parameters
- $resource : mixed
Return values
mixed —name()
public
name() : mixed
Tags
Return values
mixed —namespaces()
Return namespaces.
public
namespaces() : array<string|int, mixed>
Return values
array<string|int, mixed> —network()
Returns a Network object associated with this Networking service
public
network([string $id = null ]) : Network
Parameters
- $id : string = null
-
ID of network to retrieve
Return values
Network —object
populate()
Populates the current object based on an unknown data type.
public
populate(mixed $info[, mixed $setObjects = true ]) : mixed
Parameters
- $info : mixed
- $setObjects : mixed = true
Tags
Return values
mixed —port()
Returns a Port object associated with this Networking service
public
port([string $id = null ]) : Port
Parameters
- $id : string = null
-
ID of port to retrieve
Return values
Port —object
region()
public
region() : mixed
Tags
Return values
mixed —resource()
Factory method for instantiating resource objects.
public
resource(string $resourceName[, mixed $info = null ][, mixed $parent = null ]) : object
Parameters
- $resourceName : string
- $info : mixed = null
-
(default: null)
- $parent : mixed = null
-
The parent object
Return values
object —resourceList()
Factory method for instantiating a resource collection.
public
resourceList(string $resourceName[, string|null $url = null ][, string|null $parent = null ]) : PaginatedIterator
Parameters
- $resourceName : string
- $url : string|null = null
- $parent : string|null = null
Return values
PaginatedIterator —securityGroup()
Returns a SecurityGroup object associated with this Networking service
public
securityGroup([string $id = null ]) : SecurityGroup
Parameters
- $id : string = null
-
ID of security group to retrieve
Return values
SecurityGroup —object
securityGroupRule()
Returns a SecurityGroupRule object associated with this Networking service
public
securityGroupRule([string $id = null ]) : SecurityGroupRule
Parameters
- $id : string = null
-
ID of security group rule to retrieve
Return values
SecurityGroupRule —object
setClient()
public
setClient(ClientInterface $client) : mixed
Parameters
- $client : ClientInterface
Return values
mixed —setEndpoint()
public
setEndpoint(Endpoint $endpoint) : mixed
Parameters
- $endpoint : Endpoint
Return values
mixed —setLogger()
Sets the logger.
public
setLogger([LoggerInterface $logger = null ]) : $this
Parameters
- $logger : LoggerInterface = null
Return values
$this —stripNamespace()
public
stripNamespace(mixed $namespace) : mixed
Parameters
- $namespace : mixed
Return values
mixed —subnet()
Returns a Subnet object associated with this Networking service
public
subnet([string $id = null ]) : Subnet
Parameters
- $id : string = null
-
ID of subnet to retrieve
Return values
Subnet —object
toCamel()
Convert a string to camelCase format.
public
toCamel( $string[, bool $capitalise = true ]) : mixed
Parameters
Return values
mixed —toUnderscores()
Convert string to underscore format.
public
toUnderscores( $string) : mixed
Parameters
Return values
mixed —url()
public
url([mixed $path = null ][, array<string|int, mixed> $query = array() ]) : mixed
Parameters
- $path : mixed = null
- $query : array<string|int, mixed> = array()
Tags
Return values
mixed —getCurrentNamespace()
Internal method for accessing child namespace from parent scope.
protected
getCurrentNamespace() : type
Return values
type —getJsonHeader()
protected
static getJsonHeader() : mixed
Return values
mixed —getPatchHeaders()
protected
static getPatchHeaders() : mixed
Return values
mixed —getProperty()
Grab value out of the data array.
protected
getProperty(string $property) : mixed
Parameters
- $property : string
Return values
mixed —propertyExists()
Basic check to see whether property exists.
protected
propertyExists(string $property[, bool $allowRetry = true ]) : bool
Parameters
- $property : string
-
The property name being investigated.
- $allowRetry : bool = true
-
If set to TRUE, the check will try to format the name in underscores because there are sometimes discrepancies between camelCaseNames and underscore_names.
Return values
bool —resolveResourceClass()
Resolves FQCN for local resource.
protected
resolveResourceClass( $resourceName) : string
Parameters
Tags
Return values
string —setProperty()
We can set a property under three conditions:
protected
setProperty(mixed $property, mixed $value) : mixed
- If it has a concrete setter: setProperty()
- If the property exists
- If the property name's prefix is in an approved list
Parameters
- $property : mixed
- $value : mixed
Return values
mixed —checkAttributePrefix()
Checks the attribute $property and only permits it if the prefix is in the specified $prefixes array
private
checkAttributePrefix(string $property) : bool
This is to support extension namespaces in some services.
Parameters
- $property : string
-
the name of the attribute
Return values
bool —findEndpoint()
Extracts the appropriate endpoint from the service catalog based on the name and type of a service, and sets for further use.
private
findEndpoint() : Endpoint
Tags
Return values
Endpoint —getMetaUrl()
Constructs a specified URL from the subresource
private
getMetaUrl(string $resource) : stdClass
Given a subresource (e.g., "extensions"), this constructs the proper URL and retrieves the resource.
Parameters
- $resource : string
-
The resource requested; should NOT have slashes at the beginning or end
Return values
stdClass —object
isAccessible()
Does the property exist in the object variable list (i.e. does it have public or protected visibility?)
private
isAccessible( $property) : bool