API SoftLayer: как отменить объекты Security_Certificate, Network_Firewall и Monitoring_agent

Я создал сертификат безопасности ssl, выделенный межсетевой экран Vlan и расширенный мониторинг с использованием сложных типов API SoftLayer:

SoftLayer_Container_Product_Order_Security_Certificate
SoftLayer_Container_Product_Order_Network_Protection_Firewall_Dedicated
SoftLayer_Container_Product_Order_Monitoring_Package

Я пытаюсь найти API SoftLayer, который позволяет мне отменить эти объекты после их заказа.

Я могу получить:

SoftLayer_Security_Certificate,
SoftLayer_Network_Firewall_Module_Context_Interface,
SoftLayer_Monitoring_Agent object form SoftLayer_Account.

Но нет SoftLayer_Billing_Item тип данных на:

SoftLayer_Security_Certificate,
SoftLayer_Network_Firewall_Module_Context_Interface,
SoftLayer_Monitoring_Agent.

Это не позволит мне использовать SoftLayer_Billing_Item-> cancelService () для их отмены.

Может кто-нибудь указать мне, как я могу отменить SSL-сертификат, брандмауэр и агент мониторинга с помощью SoftLayer API? Буду признателен, если вы сможете предоставить им пример кода PHP.

0

Решение

  1. За SoftLayer_Security_Certificate, вам нужен только идентификатор из этого, вы можете получить идентификаторы сертификатов безопасности следующим способом:

Метод: SoftLayer_Account :: getSecurityCertificates
Ссылка на сайт: http://sldn.softlayer.com/reference/services/SoftLayer_Account/getSecurityCertificates

Затем вы можете удалить это, используя SoftLayer_Security_Certificate: DeleteObject метод.

Вот пример:

<?php
/**
* Delete Security Certificate
*
* This script deletes a security certificate
*
* Important manual pages:
* @see http://sldn.softlayer.com/reference/services/SoftLayer_Security_Certificate/deleteObject
*
* @license <http://sldn.softlayer.com/wiki/index.php/license>
* @author SoftLayer Technologies, Inc. <[email protected]>
*/
require_once '\vendor\autoload.php';

/**
* Your SoftLayer API username
* @var string
*/
$username = "set me";

/**
* Your SoftLayer API key
* Generate one at: https://control.softlayer.com/account/users
* @var string
*/
$apiKey = "set me";

/**
* Define the security certificate identifier. You can retrieve the identifiers from them using
* SoftLayer_Account::getSecurityCertificates
* @var int
* @see http://sldn.softlayer.com/reference/services/SoftLayer_Account/getSecurityCertificates
*/
$securityCertificateId = 14584;

// Create a SoftLayer API client object for "SoftLayer_Security_Certificate" service
$client = \SoftLayer\SoapClient::getClient('SoftLayer_Security_Certificate', null, $username, $apiKey);

// Set init parameters
$client -> setInitParameter($securityCertificateId);

try {
$result = $client -> deleteObject();
print_r($result);
} catch(Exception $e) {
echo "Unable to delete Security Certificate " . $e -> getMessage();
}

?>
  1. Относительно SoftLayer_Container_Product_Order_Network_Protection_Firewall_Dedicated объекты, которые есть в вашей учетной записи, вы можете получить все из них с помощью их billingItems с помощью следующего запроса на отдых:

    https://$user:[email protected]/rest/v3.1/SoftLayer_Search/advancedSearch?objectMask=mask[resource(SoftLayer_Network_Vlan_Firewall)[billingItem]]
    
    Method: Post
    
    {
    "parameters":[
    "_objectType:SoftLayer_Network_Vlan_Firewall _sort:[fullyQualifiedDomainName:asc]"]
    }
    

Как только вы получили billingItem из Firewall Dedicated вы можете удалить его с помощью следующего php-скрипта:

<?php
/**
* This script cancels the resource or service for a billing item
*
* Important manual pages:
* @see http://sldn.softlayer.com/reference/services/SoftLayer_Billing_Item/cancelService
*
* @license <http://sldn.softlayer.com/wiki/index.php/license>
* @author SoftLayer Technologies, Inc. <[email protected]>
*/
require_once '\vendor\autoload.php';

/**
* Your SoftLayer API username
* @var string
*/
$username = "set me";

/**
* Your SoftLayer API key
* Generate one at: https://control.softlayer.com/account/users
* @var string
*/
$apiKey = "set me";
$endPoint = "http://stable.application.qadal0501.softlayer.local/v3.1/sldn/soap/";
/**
* Declare the billing item identifier from Network Protection Firewall Dedicated
* @var int
*/
$billingItemId = 26382998;

// Create a SoftLayer API client object for "SoftLayer_Billing_Item" service
$client = \SoftLayer\SoapClient::getClient('SoftLayer_Billing_Item', null, $username, $apiKey, $endPoint);

// Set init parameters
$client -> setInitParameter($billingItemId);

try {
$result = $client -> cancelService();
print_r($result);
} catch(Exception $e) {
echo "Unable to Cancel Service: " . $e -> getMessage();
}

?>

За Пакет мониторинга Объекты, следующий скрипт поможет получить пакет мониторинга для виртуального гостя и его элемента выставления счета:

<?php
/**
* This script retrieves a billing item of "monitoring_package" category code from a virtual guest
*
* Important manual pages:
* @see http://sldn.softlayer.com/reference/datatypes/SoftLayer_Billing_Item
* @see http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/getBillingItem
*
* @license <http://sldn.softlayer.com/wiki/index.php/license>
* @author SoftLayer Technologies, Inc. <[email protected]>
*/
require_once '\vendor\autoload.php';

/**
* Your SoftLayer API username
* @var string
*/
$username = "set me";

/**
* Your SoftLayer API key
* Generate one at: https://control.softlayer.com/account/users
* @var string
*/
$apiKey = "set me";

// Declare the server identifier
$serverId = 14463961;

// Create a SoftLayer API client object for "SoftLayer_Account" service
$guestService = \SoftLayer\SoapClient::getClient('SoftLayer_Virtual_Guest', $serverId, $username, $apiKey);

// Declare an object mask to relational properties
$objectMask = "mask[activeAssociatedChildren]";
$guestService -> setObjectMask($objectMask);

try {
$billingItems = $guestService -> getBillingItem();
foreach($billingItems -> activeAssociatedChildren as $billingItem)
{
if($billingItem -> categoryCode == "monitoring_package")
{
print_r($billingItem);
}
}
} catch(Exception $e) {
echo "Unable to get billing item: " . $e -> getMessage();
}

?>

Как только вы получили billingItem из пакета мониторинга вы можете отменить это с помощью SoftLayer_Billing_Item :: cancelService.

Php SoftLayer Клиент:
https://github.com/softlayer/softlayer-api-php-client

0

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]