##Using the Openstack Network provider
Creating a client is straight-forward:
var openstack = pkgcloud.network.createClient({
provider: 'openstack',
username: 'your-user-name',
password: 'your-password',
authUrl: 'https://yourIdentity-service'
});Networks
Lists all networks that are available to use on your Openstack account
Callback returns f(err, networks) where networks is an Array
Gets specified network
Takes network or networkId as an argument and returns the network in the callback
f(err, network)
Creates a network with the options specified
Options are as follows:
{
name: 'networkName', // optional
adminStateUp : true, // optional
shared : true, // optional, Admin only
tenantId : 'tenantId' // optional, Admin only
}Returns the network in the callback f(err, network)
Updates a network with the options specified
Options are as follows:
{
id : 'networkId', // required
name: 'networkName', // optional
adminStateUp : true, // optional
shared : true, // optional, Admin only
tenantId : 'tenantId' // optional, Admin only
}Returns the network in the callback f(err, network)
Destroys the specified network
Takes network or networkId as an argument and returns the id of the destroyed network in the callback f(err, networkId)
Subnets
Lists all subnets that are available to use on your Openstack account
Callback returns f(err, subnets) where subnets is an Array
Gets specified subnet
Takes subnet or subnetId as an argument and returns the subnet in the callback
f(err, subnet)
Creates a subnet with the options specified
Options are as follows:
{
name: 'subnetName', // optional
networkId : 'networkId', // required, The ID of the attached network.
shared : true, // optional, Admin only
tenantId : 'tenantId' // optional, The ID of the tenant who owns the network. Admin-only
gatewayIp : 'gateway ip address', // optional,The gateway IP address.
enableDhcp : true // Set to true if DHCP is enabled and false if DHCP is disabled.
}Returns the subnet in the callback f(err, subnet)
Updates a subnet with the options specified
Options are as follows:
{
id : 'subnetId', // required
name: 'subnetName', // optional
networkId : 'networkId', // required, The ID of the attached network.
shared : true, // optional, Admin only
tenantId : 'tenantId' // optional, The ID of the tenant who owns the network. Admin-only
gatewayIp : 'gateway ip address', // optional,The gateway IP address.
enableDhcp : true // Set to true if DHCP is enabled and false if DHCP is disabled.
}Returns the subnet in the callback f(err, subnet)
Destroys the specified subnet
Takes subnet or subnetId as an argument and returns the id of the destroyed subnet in the callback f(err, subnetId)
Ports
Lists all ports that are available to use on your Openstack account
Callback returns f(err, ports) where ports is an Array
Gets specified port
Takes port or portId as an argument and returns the port in the callback
f(err, port)
Creates a port with the options specified
Options are as follows:
{
name: 'portName', // optional
adminStateUp : true, // optional, The administrative status of the router. Admin-only
networkId : 'networkId', // required, The ID of the attached network.
status : 'text status', // optional, The status of the port.
tenantId : 'tenantId' // optional, The ID of the tenant who owns the network. Admin-only
macAddress: 'mac address' // optional
fixedIps : ['ip address1', 'ip address 2'], // optional.
securityGroups : ['security group1', 'security group2'] // optional, Specify one or more security group IDs.
}Returns the port in the callback f(err, port)
Updates a port with the options specified
Options are as follows:
{
id : 'portId', // required
name: 'portName', // optional
adminStateUp : true, // optional, The administrative status of the router. Admin-only
networkId : 'networkId', // required, The ID of the attached network.
status : 'text status', // optional, The status of the port.
tenantId : 'tenantId' // optional, The ID of the tenant who owns the network. Admin-only
macAddress: 'mac address' // optional
fixedIps : ['ip address1', 'ip address 2'], // optional.
securityGroups : ['security group1', 'security group2'] // optional, Specify one or more security group IDs.
}Returns the port in the callback f(err, port)
Destroys the specified port
Takes port or portId as an argument and returns the id of the destroyed port in the callback f(err, portId)