/** * Update Network action (PUT /networks/network-id) * * Updates the specified network. * Either name or admin_state_up must be provided for this action. * * @param string $networkId The ID of the network to update. * @param string $name optional A string specifying a symbolic name for the network, * which is not required to be unique * @param bool $adminStateUp optional The administrative status of the network * @return object Returns detailed information for the updated network * @throws RestClientException * @throws \BadFunctionCallException */ public function updateNetwork($networkId, $name = null, $adminStateUp = null) { $result = null; $network = array(); if ($name !== null) { $network['name'] = (string) $name; } if ($adminStateUp !== null) { $network['admin_state_up'] = (string) BooleanType::init($adminStateUp); } if (empty($network)) { throw new \BadFunctionCallException(sprintf("Bad request. Either name or admin_state_up must have been provided for %s action."), __FUNCTION__); } $response = $this->getClient()->call($this->service, sprintf('/networks/%s', $this->escape($networkId)), array('_putData' => json_encode(array('network' => $network))), 'PUT'); if ($response->hasError() === false) { $result = json_decode($response->getContent()); $result = $result->network; } return $result; }
/** * Sets the admin state flag * * @param boolean $adminStateUp The admin state flag * @return ListNetworksFilter */ public function setAdminStateUp($adminStateUp = null) { $this->adminStateUp = $adminStateUp !== null ? BooleanType::init($adminStateUp) : null; return $this; }
/** * Sets the shared flag * * @param boolean $shared The shared flag * @return ListNetworksFilter */ public function setShared($shared = null) { $this->shared = $shared !== null ? BooleanType::init($shared) : null; return $this; }