* may not use this file except in compliance with the License. A copy * of the License is located at * * http://aws.amazon.com/apache2.0/ * * or in the "license.txt" file accompanying this file. This file is * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS * OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the * License. */ error_reporting(E_ALL); require_once 'sdk.class.php'; require_once 'include/book.inc.php'; // Create the CloudFront access object $cf = new AmazonCloudFront(); // Retrieve list of CloudFront distributions $res = $cf->list_distributions(); if (!$res->isOK()) { exit("Could not retrieve list of CloudFront distributions\n"); } $distributions = $res->body->DistributionSummary; printf("%-16s %-32s %-40s\n", "ID", "Domain Name", "Origin"); printf("%'=-16s %'=-32s %'=40s\n", "", "", ""); // Display list of distributions foreach ($distributions as $distribution) { $id = $distribution->Id; $domainName = $distribution->DomainName; $origin = $distribution->S3Origin->DNSName; printf("%-16s %-32s %-40s\n", $id, $domainName, $origin); }
public function deleteAmazonDistribution($dist_id) { ProjectConfiguration::registerAws(); $cdn = new AmazonCloudFront(); $original = $cdn->get_distribution_config($dist_id); if ($original->isOK()) { $etag = $original->header['etag']; $new_xml = $cdn->update_config_xml($original, array('Enabled' => false)); $response = $cdn->set_distribution_config($dist_id, $new_xml, $etag); if ($response->isOK()) { $response = $cdn->delete_distribution($dist_id, $etag); return $response->isOK(); } } return false; }
public function xDeleteDistributionAction() { $AmazonCloudFront = new AmazonCloudFront($this->environment->getPlatformConfigValue(Modules_Platforms_Ec2::ACCESS_KEY), $this->environment->getPlatformConfigValue(Modules_Platforms_Ec2::SECRET_KEY)); $result = $AmazonCloudFront->DeleteDistribution($this->getParam('id')); $info = $this->db->GetRow("SELECT * FROM distributions WHERE cfid=?", array($this->getParam('id'))); if ($info) { $this->db->Execute("DELETE FROM distributions WHERE cfid=?", array($this->getParam('id'))); // Remove CNAME from DNS zone /* $zoneinfo = $this->db->GetRow("SELECT * FROM dns_zones WHERE zone_name=? AND client_id=?", array($info['zone'], $this->user->getAccountId()) ); if ($zoneinfo) { $this->db->Execute("DELETE FROM dns_zone_records WHERE zone_id = ? AND type = ? AND name = ? AND value = ? ", array($zoneinfo['id'], 'CNAME', $this->getParam('cname'), $this->getParam('cfurl'))); }*/ } $this->response->success("Distribution successfully removed"); }