public function createRole($name, $type = self::ROLE_WEB, $override = false)
    {
        $serviceDefinition = $this->getServiceDefinition();
        $serviceConfig = $this->getServiceConfiguration();
        
        switch ($type) {
            case self::ROLE_WEB:
                $serviceDefinition->addWebRole($name);
                $serviceConfig->addRole($name);
                
                $filesystem = new Filesystem();
                $filesystem->mkdir($this->configDir . '/' . $name);
                $filesystem->copy(__DIR__ . '/../Resources/role_template/web.config', $this->configDir . '/' . $name . '/web.config', $override);
                $filesystem->copy(__DIR__ . '/../Resources/role_template/index.php', $this->configDir . '/' . $name . '/index.php', $override);
                $filesystem->copy(__DIR__ . '/../Resources/role_template/diagnostics.wadcfg', $this->binDir . '/diagnostics.wadcfg', $override);
                // TODO: explicit directory more robust?
                $filesystem->copy(__DIR__ . '/../Resources/role_template/config_azure.yml', $this->configDir . '/../config/config_azure.yml', $override);
                $filesystem->copy(__DIR__ . '/../Resources/role_template/parameters_azure.yml', $this->configDir . '/../config/parameters_azure.yml', $override);
                break;
            default:
                throw new \RuntimeException("Unsupported role $type cannot be created");
        }
    }
public function createRole($name, $type = self::ROLE_WEB, $override = false)
    {
        $serviceDefinition = $this->getServiceDefinition();
        $serviceConfig = $this->getServiceConfiguration();
        
        switch ($type) {
            case self::ROLE_WEB:
                $serviceDefinition->addWebRole($name);
                $serviceConfig->addRole($name);
                
                $filesystem = new Filesystem();
                $filesystem->mkdir($this->configDir . '/' . $name);
                $filesystem->copy(__DIR__ . '/../Resources/role_template/web.config', $this->configDir . '/' . $name . '/web.config', $override);
                $filesystem->copy(__DIR__ . '/../Resources/role_template/index.php', $this->configDir . '/' . $name . '/index.php', $override);
                $filesystem->copy(__DIR__ . '/../Resources/role_template/diagnostics.wadcfg', $this->binDir . '/diagnostics.wadcfg', $override);
                // TODO: explicit directory more robust?
                $filesystem->copy(__DIR__ . '/../Resources/role_template/config_azure.yml', $this->configDir . '/../config/config_azure.yml', $override);
                $filesystem->copy(__DIR__ . '/../Resources/role_template/parameters_azure.yml', $this->configDir . '/../config/parameters_azure.yml', $override);
                break;
            default:
                throw new \RuntimeException("Unsupported role $type cannot be created");
        }
    }
public function createRole ( $ name , $ type = self :: ROLE_WEB , $ override = false ) { $ serviceDefinition = $ this -> getServiceDefinition ( ) ; $ serviceConfig = $ this -> getServiceConfiguration ( ) ; switch ( $ type ) { case self :: ROLE_WEB : $ serviceDefinition -> addWebRole ( $ name ) ; $ serviceConfig -> addRole ( $ name ) ; $ filesystem = new Filesystem ( ) ; $ filesystem -> mkdir ( $ this -> configDir . '/' . $ name ) ; $ filesystem -> copy ( __DIR__ . '/../Resources/role_template/web.config' , $ this -> configDir . '/' . $ name . '/web.config' , $ override ) ; $ filesystem -> copy ( __DIR__ . '/../Resources/role_template/index.php' , $ this -> configDir . '/' . $ name . '/index.php' , $ override ) ; $ filesystem -> copy ( __DIR__ . '/../Resources/role_template/diagnostics.wadcfg' , $ this -> binDir . '/diagnostics.wadcfg' , $ override ) ; // TODO: explicit directory more robust? $ filesystem -> copy ( __DIR__ . '/../Resources/role_template/config_azure.yml' , $ this -> configDir . '/../config/config_azure.yml' , $ override ) ; $ filesystem -> copy ( __DIR__ . '/../Resources/role_template/parameters_azure.yml' , $ this -> configDir . '/../config/parameters_azure.yml' , $ override ) ; break ; default : throw new \ RuntimeException ( "Unsupported role $type cannot be created" ) ; } }
Create a new role for this Azure Deployment

@param string $name
@param string $type
@param bool $override
@return void
@throws RuntimeException - Unknown role given
Create a new role for this Azure Deployment