示例#1
0
 /**
  * Sets subnets
  *
  * @param   array|SubnetList $subnets
  * @return  VirtualNetworkProperties
  */
 public function setSubnets($subnets = null)
 {
     if (!$subnets instanceof SubnetList) {
         $subnetList = new SubnetList();
         foreach ((array) $subnets as $subnet) {
             if (!$subnet instanceof SubnetData) {
                 $subnetData = SubnetData::initArray($subnet);
             } else {
                 $subnetData = $subnet;
             }
             $subnetList->append($subnetData);
         }
     } else {
         $subnetList = $subnets;
     }
     return $this->__call(__FUNCTION__, [$subnetList]);
 }
 /**
  * Sets subnet
  *
  * @param   array|SubnetData $subnet
  * @return  IpConfigurationProperties
  */
 public function setSubnet($subnet = null)
 {
     if (!$subnet instanceof SubnetData) {
         $subnet = SubnetData::initArray($subnet);
     }
     return $this->__call(__FUNCTION__, [$subnet]);
 }
示例#3
0
文件: Subnets.php 项目: mheydt/scalr
 /**
  * Create a subnet for subnet.
  *
  * @param string $subscriptionId       Subscription Id
  * @param string $resourceGroupName    Name of Resource Group
  * @param string $virtualNetworkName   Name of the virtual network
  * @param string $name                 Name for new subnet
  * @param string $addressPrefix        optional Address prefix for the subnet
  * @param array  $networkSecurityGroup optional URI of the network security group resource
  *                                     Example Format: ["id" => "/subscriptions/{guid}/../microsoft.network/networkSecurityGroups/myNSG1"]
  *
  * @return SubnetData Object with response
  */
 public function create($subscriptionId, $resourceGroupName, $virtualNetworkName, $name, $addressPrefix = null, array $networkSecurityGroup = null)
 {
     $result = null;
     $path = '/subscriptions/' . $subscriptionId . '/resourceGroups/' . $resourceGroupName . NetworkService::ENDPOINT_MICROSOFT_NETWORK . '/virtualNetworks/' . $virtualNetworkName . '/subnets/' . $name;
     $requestData = [];
     if (isset($addressPrefix)) {
         $requestData['properties']['addressPrefix'] = $addressPrefix;
     }
     if (isset($networkSecurityGroup)) {
         $requestData['properties']['networkSecurityGroup'] = $networkSecurityGroup;
     }
     $request = $this->getClient()->prepareRequest($path, 'PUT', $this->getApiVersion(), $this->getServiceUrl(), [], $requestData);
     $response = $this->getClient()->call($request);
     if (!$response->hasError()) {
         $result = SubnetData::initArray($response->getResult());
     }
     return $result;
 }