public function update($name, $attrs) {

    $headers = array();
    foreach ($attrs as $item => $val) {
      switch ($item) {
        case 'ttl':
          $headers['X-TTL'] = (int) $val;
          break;
        case 'enabled':
        case 'cdn_enabled':
          if (isset($val) && $val == FALSE) {
            $flag = 'False';
          }
          // Default is TRUE.
          else {
            $flag = 'True';
          }
          $headers['X-CDN-Enabled'] = $flag;
          break;
        case 'logs':
        case 'log_retention':
          // The default is TRUE.
          if (isset($val) && $val == FALSE) {
            $flag = 'False';
          }
          else {
            $flag = 'True';
          }
          $headers['X-Log-Retention'] = $flag;
          break;
        default:
          $headers[$item] = (string) $val;
          break;
      }

    }

    $response = $this->modifyContainer($name, 'POST', $headers);

    return $response->status() == 204;
  }
public function update($name, $attrs) {

    $headers = array();
    foreach ($attrs as $item => $val) {
      switch ($item) {
        case 'ttl':
          $headers['X-TTL'] = (int) $val;
          break;
        case 'enabled':
        case 'cdn_enabled':
          if (isset($val) && $val == FALSE) {
            $flag = 'False';
          }
          // Default is TRUE.
          else {
            $flag = 'True';
          }
          $headers['X-CDN-Enabled'] = $flag;
          break;
        case 'logs':
        case 'log_retention':
          // The default is TRUE.
          if (isset($val) && $val == FALSE) {
            $flag = 'False';
          }
          else {
            $flag = 'True';
          }
          $headers['X-Log-Retention'] = $flag;
          break;
        default:
          $headers[$item] = (string) $val;
          break;
      }

    }

    $response = $this->modifyContainer($name, 'POST', $headers);

    return $response->status() == 204;
  }
public function update ( $ name , $ attrs ) { $ headers = array ( ) ; foreach ( $ attrs as $ item => $ val ) { switch ( $ item ) { case 'ttl' : $ headers [ 'X-TTL' ] = ( int ) $ val ; break ; case 'enabled' : case 'cdn_enabled' : if ( isset ( $ val ) && $ val == FALSE ) { $ flag = 'False' ; } // Default is TRUE. else { $ flag = 'True' ; } $ headers [ 'X-CDN-Enabled' ] = $ flag ; break ; case 'logs' : case 'log_retention' : // The default is TRUE. if ( isset ( $ val ) && $ val == FALSE ) { $ flag = 'False' ; } else { $ flag = 'True' ; } $ headers [ 'X-Log-Retention' ] = $ flag ; break ; default : $ headers [ $ item ] = ( string ) $ val ; break ; } } $ response = $ this -> modifyContainer ( $ name , 'POST' , $ headers ) ; return $ response -> status ( ) == 204 ; }
Set attributes on a CDN container.

This updates the attributes (that is, properties) of a container.

The following attributes are supported:

- 'ttl': Time to life in seconds (int).
- 'cdn_enabled': Whether the CDN is enabled (boolean).
- 'log_retention': Whether logs are retained (boolean). UNSUPPORTED.

Future versions of the CDN service will likely provide other
properties.

@param string $name
The name of the container.
@param array $attrs
An associative array of attributes.
@retval boolean
@return boolean
TRUE if the update was successful.
@throws HPCloud::Exception
Possibly throws one of the HTTP exceptions.
Set attributes on a CDN container .