src/ServiceManagement/ServiceManagementRestProxy.php
public function createAffinityGroup($name, $label, $location, CreateAffinityGroupOptions $options = null)
    {
        Validate::isString($name, 'name');
        Validate::notNullOrEmpty($name, 'name');
        Validate::isString($label, 'label');
        Validate::notNullOrEmpty($label, 'label');
        Validate::isString($location, 'location');
        Validate::notNullOrEmpty($location, 'location');

        if (is_null($options)) {
            $options = new CreateAffinityGroupOptions();
        }

        $affinityGroup = new AffinityGroup();
        $affinityGroup->setName($name);
        $affinityGroup->setLabel($label);
        $affinityGroup->setLocation($location);
        $affinityGroup->setDescription($options->getDescription());
        $affinityGroup->addSerializationProperty(
            XmlSerializer::ROOT_NAME,
            Resources::XTAG_CREATE_AFFINITY_GROUP
        );

        $context = new HttpCallContext();
        $context->setMethod(Resources::HTTP_POST);
        $context->setPath($this->_getAffinityGroupPath());
        $context->addStatusCode(Resources::STATUS_CREATED);
        $context->setBody($affinityGroup->serialize($this->dataSerializer));
        $context->addHeader(
            Resources::CONTENT_TYPE,
            Resources::XML_CONTENT_TYPE
        );

        $this->sendHttpContext($context);
    }
public function createAffinityGroup($name, $label, $location, CreateAffinityGroupOptions $options = null)
    {
        Validate::isString($name, 'name');
        Validate::notNullOrEmpty($name, 'name');
        Validate::isString($label, 'label');
        Validate::notNullOrEmpty($label, 'label');
        Validate::isString($location, 'location');
        Validate::notNullOrEmpty($location, 'location');

        if (is_null($options)) {
            $options = new CreateAffinityGroupOptions();
        }

        $affinityGroup = new AffinityGroup();
        $affinityGroup->setName($name);
        $affinityGroup->setLabel($label);
        $affinityGroup->setLocation($location);
        $affinityGroup->setDescription($options->getDescription());
        $affinityGroup->addSerializationProperty(
            XmlSerializer::ROOT_NAME,
            Resources::XTAG_CREATE_AFFINITY_GROUP
        );

        $context = new HttpCallContext();
        $context->setMethod(Resources::HTTP_POST);
        $context->setPath($this->_getAffinityGroupPath());
        $context->addStatusCode(Resources::STATUS_CREATED);
        $context->setBody($affinityGroup->serialize($this->dataSerializer));
        $context->addHeader(
            Resources::CONTENT_TYPE,
            Resources::XML_CONTENT_TYPE
        );

        $this->sendHttpContext($context);
    }
public function createAffinityGroup ( $ name , $ label , $ location , CreateAffinityGroupOptions $ options = null ) { Validate :: isString ( $ name , 'name' ) ; Validate :: notNullOrEmpty ( $ name , 'name' ) ; Validate :: isString ( $ label , 'label' ) ; Validate :: notNullOrEmpty ( $ label , 'label' ) ; Validate :: isString ( $ location , 'location' ) ; Validate :: notNullOrEmpty ( $ location , 'location' ) ; if ( is_null ( $ options ) ) { $ options = new CreateAffinityGroupOptions ( ) ; } $ affinityGroup = new AffinityGroup ( ) ; $ affinityGroup -> setName ( $ name ) ; $ affinityGroup -> setLabel ( $ label ) ; $ affinityGroup -> setLocation ( $ location ) ; $ affinityGroup -> setDescription ( $ options -> getDescription ( ) ) ; $ affinityGroup -> addSerializationProperty ( XmlSerializer :: ROOT_NAME , Resources :: XTAG_CREATE_AFFINITY_GROUP ) ; $ context = new HttpCallContext ( ) ; $ context -> setMethod ( Resources :: HTTP_POST ) ; $ context -> setPath ( $ this -> _getAffinityGroupPath ( ) ) ; $ context -> addStatusCode ( Resources :: STATUS_CREATED ) ; $ context -> setBody ( $ affinityGroup -> serialize ( $ this -> dataSerializer ) ) ; $ context -> addHeader ( Resources :: CONTENT_TYPE , Resources :: XML_CONTENT_TYPE ) ; $ this -> sendHttpContext ( $ context ) ; }
Creates a new affinity group for the specified subscription.

@param string                     $name     The affinity group name
@param string                     $label    The base-64 encoded name for the
affinity group. The name can be up to 100 characters in length
@param string                     $location The data center location where the
affinity group will be created. To list available locations, use the
listLocations API
@param CreateAffinityGroupOptions $options  The optional parameters

@see http://msdn.microsoft.com/en-us/library/windowsazure/gg715317.aspx
Creates a new affinity group for the specified subscription .