Php SoftLayer API:如何取消安全证书、网络防火墙和监视代理对象
我使用SoftLayer API复杂类型创建了ssl安全证书、专用Vlan防火墙和高级监控:Php SoftLayer API:如何取消安全证书、网络防火墙和监视代理对象,php,api,ibm-cloud-infrastructure,Php,Api,Ibm Cloud Infrastructure,我使用SoftLayer API复杂类型创建了ssl安全证书、专用Vlan防火墙和高级监控: SoftLayer_Container_Product_Order_Security_Certificate SoftLayer_Container_Product_Order_Network_Protection_Firewall_Dedicated SoftLayer_Container_Product_Order_Monitoring_Package 我试图找到SoftLayer API,它允许
SoftLayer_Container_Product_Order_Security_Certificate
SoftLayer_Container_Product_Order_Network_Protection_Firewall_Dedicated
SoftLayer_Container_Product_Order_Monitoring_Package
我试图找到SoftLayer API,它允许我在订购这些对象后取消它们
我可以获得:
SoftLayer_Security_Certificate,
SoftLayer_Network_Firewall_Module_Context_Interface,
SoftLayer_Monitoring_Agent object form SoftLayer_Account.
但在以下项目上没有SoftLayer\u Billing\u项目
数据类型:
SoftLayer_Security_Certificate,
SoftLayer_Network_Firewall_Module_Context_Interface,
SoftLayer_Monitoring_Agent.
这将不允许我使用SoftLayer\u Billing\u Item->cancelService()来取消它们
有人能告诉我如何使用SoftLayer API取消SSL证书、防火墙和监控代理吗?如果您能提供PHP示例代码,我将不胜感激
<?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. <sldn@softlayer.com>
*/
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();
}
?>
一旦您从Firewall Specialized获得了billingItem,您可以使用以下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. <sldn@softlayer.com>
*/
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. <sldn@softlayer.com>
*/
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();
}
?>
一旦您从监控软件包中获得了计费项目,您可以使用SoftLayer\u Billing\u Item::cancelService取消此操作
Php软件层客户端:
我是通过另一个问题得到答案的,请参见“谢谢你,鲁伯”。另一个问题,我订购了设备(虚拟客户机或裸机服务器)上的“100Mbps硬件防火墙”,而不是vlan上的,使用复杂类型的软层、容器、产品、订单、网络、保护、防火墙。如何获取设备上的防火墙列表,是否可以使用相同的“网络\u Vlan\u防火墙”对象?您好mnnmountain,请尝试以下方法:1。对于虚拟客户:2。对于裸金属:
<?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. <sldn@softlayer.com>
*/
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();
}
?>