Controller/Adminhtml/FastlyCdn/Edge/Dictionary/Delete.php
public function execute()
    {
        $result = $this->resultJson->create();

        try {
            $activeVersion = $this->getRequest()->getParam('active_version');
            $activateVcl = $this->getRequest()->getParam('activate_flag');
            $dictionary_o = $this->getRequest()->getParam('dictionary');
            $dictionary = preg_replace('/\s+/', '%20', $dictionary_o);
            $service = $this->api->checkServiceDetails();
            $this->vcl->checkCurrentVersionActive($service->versions, $activeVersion);
            $currActiveVersion = $this->vcl->getCurrentVersion($service->versions);
            $clone = $this->api->cloneVersion($currActiveVersion);
            $used = '';

            $response = $this->api->deleteDictionary($clone->number, $dictionary);

            if ($response == false) {
                return $result->setData([
                    'status'    => false,
                    'msg'       => 'Failed to delete dictionary.'
                ]);
            }
            $validation = $this->api->containerValidateServiceVersion($clone->number);
            if ($validation->status == 'error') {
                $used = $dictionary;
            }
            if ($used != '') {
                throw new LocalizedException(__(
                    'Failed to validate service, the container "' . $used . '" may be in use. '
                ));
            }

            if ($activateVcl === 'true') {
                $this->api->activateVersion($clone->number);
            }

            $comment = ['comment' => 'Magento Module deleted the "'.$dictionary_o.'" Dictionary'];
            $this->api->addComment($clone->number, $comment);

            return $result->setData([
                'status'            => true,
                'active_version'    => $clone->number
            ]);
        } catch (\Exception $e) {
            return $result->setData([
                'status'    => false,
                'msg'       => $e->getMessage()
            ]);
        }
    }
public function execute()
    {
        $result = $this->resultJson->create();

        try {
            $activeVersion = $this->getRequest()->getParam('active_version');
            $activateVcl = $this->getRequest()->getParam('activate_flag');
            $dictionary_o = $this->getRequest()->getParam('dictionary');
            $dictionary = preg_replace('/\s+/', '%20', $dictionary_o);
            $service = $this->api->checkServiceDetails();
            $this->vcl->checkCurrentVersionActive($service->versions, $activeVersion);
            $currActiveVersion = $this->vcl->getCurrentVersion($service->versions);
            $clone = $this->api->cloneVersion($currActiveVersion);
            $used = '';

            $response = $this->api->deleteDictionary($clone->number, $dictionary);

            if ($response == false) {
                return $result->setData([
                    'status'    => false,
                    'msg'       => 'Failed to delete dictionary.'
                ]);
            }
            $validation = $this->api->containerValidateServiceVersion($clone->number);
            if ($validation->status == 'error') {
                $used = $dictionary;
            }
            if ($used != '') {
                throw new LocalizedException(__(
                    'Failed to validate service, the container "' . $used . '" may be in use. '
                ));
            }

            if ($activateVcl === 'true') {
                $this->api->activateVersion($clone->number);
            }

            $comment = ['comment' => 'Magento Module deleted the "'.$dictionary_o.'" Dictionary'];
            $this->api->addComment($clone->number, $comment);

            return $result->setData([
                'status'            => true,
                'active_version'    => $clone->number
            ]);
        } catch (\Exception $e) {
            return $result->setData([
                'status'    => false,
                'msg'       => $e->getMessage()
            ]);
        }
    }
public function execute ( ) { $ result = $ this -> resultJson -> create ( ) ; try { $ activeVersion = $ this -> getRequest ( ) -> getParam ( 'active_version' ) ; $ activateVcl = $ this -> getRequest ( ) -> getParam ( 'activate_flag' ) ; $ dictionary_o = $ this -> getRequest ( ) -> getParam ( 'dictionary' ) ; $ dictionary = preg_replace ( '/\s+/' , '%20' , $ dictionary_o ) ; $ service = $ this -> api -> checkServiceDetails ( ) ; $ this -> vcl -> checkCurrentVersionActive ( $ service -> versions , $ activeVersion ) ; $ currActiveVersion = $ this -> vcl -> getCurrentVersion ( $ service -> versions ) ; $ clone = $ this -> api -> cloneVersion ( $ currActiveVersion ) ; $ used = '' ; $ response = $ this -> api -> deleteDictionary ( $ clone -> number , $ dictionary ) ; if ( $ response == false ) { return $ result -> setData ( [ 'status' => false , 'msg' => 'Failed to delete dictionary.' ] ) ; } $ validation = $ this -> api -> containerValidateServiceVersion ( $ clone -> number ) ; if ( $ validation -> status == 'error' ) { $ used = $ dictionary ; } if ( $ used != '' ) { throw new LocalizedException ( __ ( 'Failed to validate service, the container "' . $ used . '" may be in use. ' ) ) ; } if ( $ activateVcl === 'true' ) { $ this -> api -> activateVersion ( $ clone -> number ) ; } $ comment = [ 'comment' => 'Magento Module deleted the "' . $ dictionary_o . '" Dictionary' ] ; $ this -> api -> addComment ( $ clone -> number , $ comment ) ; return $ result -> setData ( [ 'status' => true , 'active_version' => $ clone -> number ] ) ; } catch ( \ Exception $ e ) { return $ result -> setData ( [ 'status' => false , 'msg' => $ e -> getMessage ( ) ] ) ; } }
Delete dictionary

@return $this|\Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface
Delete dictionary