src/ServiceManagement/ServiceManagementRestProxy.php
public function createHostedService($name, $label, CreateServiceOptions $options)
    {
        Validate::isString($name, 'name');
        Validate::notNullOrEmpty($name, 'name');
        Validate::isString($label, 'label');
        Validate::notNullOrEmpty($label, 'label');
        Validate::notNullOrEmpty($options, 'options');

        // User have to set affinity group or location.
        $affinityGroup = $options->getAffinityGroup();
        $location = $options->getLocation();
        Validate::isTrue(
            !empty($location) || !empty($affinityGroup),
            Resources::INVALID_CREATE_SERVICE_OPTIONS_MSG
        );

        $hostedService = new HostedService();
        $hostedService->setName($name);
        $hostedService->setLabel($label);
        $hostedService->setLocation($options->getLocation());
        $hostedService->setAffinityGroup($options->getAffinityGroup());
        $hostedService->setDescription($options->getDescription());
        $hostedService->addSerializationProperty(
            XmlSerializer::ROOT_NAME,
            Resources::XTAG_CREATE_HOSTED_SERVICE
        );

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

        $this->sendHttpContext($context);
    }
public function createHostedService($name, $label, CreateServiceOptions $options)
    {
        Validate::isString($name, 'name');
        Validate::notNullOrEmpty($name, 'name');
        Validate::isString($label, 'label');
        Validate::notNullOrEmpty($label, 'label');
        Validate::notNullOrEmpty($options, 'options');

        // User have to set affinity group or location.
        $affinityGroup = $options->getAffinityGroup();
        $location = $options->getLocation();
        Validate::isTrue(
            !empty($location) || !empty($affinityGroup),
            Resources::INVALID_CREATE_SERVICE_OPTIONS_MSG
        );

        $hostedService = new HostedService();
        $hostedService->setName($name);
        $hostedService->setLabel($label);
        $hostedService->setLocation($options->getLocation());
        $hostedService->setAffinityGroup($options->getAffinityGroup());
        $hostedService->setDescription($options->getDescription());
        $hostedService->addSerializationProperty(
            XmlSerializer::ROOT_NAME,
            Resources::XTAG_CREATE_HOSTED_SERVICE
        );

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

        $this->sendHttpContext($context);
    }
public function createHostedService ( $ name , $ label , CreateServiceOptions $ options ) { Validate :: isString ( $ name , 'name' ) ; Validate :: notNullOrEmpty ( $ name , 'name' ) ; Validate :: isString ( $ label , 'label' ) ; Validate :: notNullOrEmpty ( $ label , 'label' ) ; Validate :: notNullOrEmpty ( $ options , 'options' ) ; // User have to set affinity group or location. $ affinityGroup = $ options -> getAffinityGroup ( ) ; $ location = $ options -> getLocation ( ) ; Validate :: isTrue ( ! empty ( $ location ) || ! empty ( $ affinityGroup ) , Resources :: INVALID_CREATE_SERVICE_OPTIONS_MSG ) ; $ hostedService = new HostedService ( ) ; $ hostedService -> setName ( $ name ) ; $ hostedService -> setLabel ( $ label ) ; $ hostedService -> setLocation ( $ options -> getLocation ( ) ) ; $ hostedService -> setAffinityGroup ( $ options -> getAffinityGroup ( ) ) ; $ hostedService -> setDescription ( $ options -> getDescription ( ) ) ; $ hostedService -> addSerializationProperty ( XmlSerializer :: ROOT_NAME , Resources :: XTAG_CREATE_HOSTED_SERVICE ) ; $ context = new HttpCallContext ( ) ; $ context -> setMethod ( Resources :: HTTP_POST ) ; $ context -> setPath ( $ this -> _getHostedServicePath ( ) ) ; $ context -> addStatusCode ( Resources :: STATUS_CREATED ) ; $ context -> setBody ( $ hostedService -> serialize ( $ this -> dataSerializer ) ) ; $ context -> addHeader ( Resources :: CONTENT_TYPE , Resources :: XML_CONTENT_TYPE ) ; $ this -> sendHttpContext ( $ context ) ; }
Creates a new hosted service in Windows Azure.

@param string               $name    The name for the hosted service that is unique within Windows Azure. This
name is the DNS prefix name and can be used to access the hosted service
@param string               $label   The name for the hosted service that is base-64 encoded. The name can be
used identify the storage account for your tracking purposes
@param CreateServiceOptions $options The optional parameters

@see http://msdn.microsoft.com/en-us/library/windowsazure/gg441304.aspx
Creates a new hosted service in Windows Azure .