Ejemplo n.º 1
0
 /**
  * Sets properties
  *
  * @param   array|SecurityRuleProperties $properties
  * @return  CreateSecurityRule
  */
 public function setProperties($properties = null)
 {
     if (!$properties instanceof SecurityRuleProperties) {
         $properties = SecurityRuleProperties::initArray($properties);
     }
     return $this->__call(__FUNCTION__, [$properties]);
 }
Ejemplo n.º 2
0
 /**
  * Creates security rule in a security group.
  *
  * @param string $subscriptionId     Subscription Id
  * @param string $resourceGroupName  Name of Resource Group
  * @param string $securityGroupName  Name of Security Group
  * @param string $securityRuleName   Name of Security Rule
  * @param array|CreateSecurityRule   Request data
  *
  * @return SecurityRuleProperties Object with response
  */
 public function create($subscriptionId, $resourceGroupName, $securityGroupName, $securityRuleName, $requestData)
 {
     $result = null;
     if (!$requestData instanceof CreateSecurityRule) {
         $requestData = CreateSecurityRule::initArray($requestData);
     }
     $path = '/subscriptions/' . $subscriptionId . '/resourceGroups/' . $resourceGroupName . NetworkService::ENDPOINT_MICROSOFT_NETWORK . '/networkSecurityGroups/' . $securityGroupName . '/securityRules/' . $securityRuleName;
     $request = $this->getClient()->prepareRequest($path, 'PUT', $this->getApiVersion(), $this->getServiceUrl(), [], $requestData->toArray());
     $response = $this->getClient()->call($request);
     if (!$response->hasError()) {
         $result = SecurityRuleProperties::initArray($response->getResult());
     }
     return $result;
 }