Operation getServersAsync



@param  string $org_id Organization ID (optional)
@param  string $name Server name (optional)

@throws \InvalidArgumentException
@return \GuzzleHttp\Promise\PromiseInterface
5015
public function getServersAsync($org_id = null, $name = null)
    {
        return $this->getServersAsyncWithHttpInfo($org_id, $name)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }
490203
public function getCommand($name, array $args = array()) {
    /*if($name != 'oauth') {
		  $this->checkAuth();
    }*/

    $command = parent::getCommand($name, $args);
    $this->command_history[] = $command;
		return $command;
	}
991082
public function getApps($org_id = null, $name = null)
    {
        list($response) = $this->getAppsWithHttpInfo($org_id, $name);
        return $response;
    }
161475
public static StructrOAuthClient getServer(final String name) {

		String configuredOauthServers  = Settings.OAuthServers.getValue();
		String[] authServers = configuredOauthServers.split(" ");

		for (String authServer : authServers) {

			if (authServer.equals(name)) {

				String authLocation  = Settings.getOrCreateStringSetting("oauth", authServer, "authorization_location").getValue("");
				String tokenLocation = Settings.getOrCreateStringSetting("oauth", authServer, "token_location").getValue("");
				String clientId      = Settings.getOrCreateStringSetting("oauth", authServer, "client_id").getValue("");
				String clientSecret  = Settings.getOrCreateStringSetting("oauth", authServer, "client_secret").getValue("");
				String redirectUri   = Settings.getOrCreateStringSetting("oauth", authServer, "redirect_uri").getValue("");

				// Minumum required fields
				if (clientId != null && clientSecret != null && redirectUri != null) {

					Class serverClass		= getServerClassForName(name);
					Class tokenResponseClass	= getTokenResponseClassForName(name);

					if (serverClass != null) {

						StructrOAuthClient oauthServer;
						try {

							oauthServer = (StructrOAuthClient) serverClass.newInstance();
							oauthServer.init(authLocation, tokenLocation, clientId, clientSecret, redirectUri, tokenResponseClass);

							logger.info("Using OAuth server {}", oauthServer);

							return oauthServer;

						} catch (Throwable t) {

							logger.error("Could not instantiate auth server", t);

						}
						
					} else {
					
						logger.warn("No OAuth provider found for name {}, ignoring.", name);
					}
				}
			}
		}

		return null;
	}
1182965
private function createServiceFromDelegator(string $name, array $options = null)
    {
        // @todo: This selection is necessary only because lazy services
        // configuration currently requires an explicit Delegator definition
        if ($this->delegators[$name][0] === Proxy\LazyServiceFactory::class) {
            return $this->createServiceFromLazyServiceDelegator($name, $options);
        }

        $creationCallback = $this->delegatorCallbackCache[$name] ?? null;
        if ($creationCallback) {
            $object = $creationCallback($this->creationContext, $name, $creationCallback, $options);
            return $object;
        }

        $creationCallback = function () use ($name, $options) {
            return $this->createServiceFromFactory($name, $options);
        };

        foreach ($this->delegators[$name] as $index => $delegatorFactory) {
            if (is_string($delegatorFactory) && class_exists($delegatorFactory)) {
                $delegatorFactory = new $delegatorFactory();
                if ($delegatorFactory instanceof DelegatorFactoryInterface) {
                    $this->delegators[$name][$index] = $delegatorFactory;
                    $creationCallback = function () use ($delegatorFactory, $name, $creationCallback, $options) {
                        return $delegatorFactory($this->creationContext, $name, $creationCallback, $options);
                    };
                    continue;
                }
            }
            if (is_callable($delegatorFactory)) {
                $creationCallback = function () use ($delegatorFactory, $name, $creationCallback, $options) {
                    return $delegatorFactory($this->creationContext, $name, $creationCallback, $options);
                };
                continue;
            }
            if (is_string($delegatorFactory)) {
                throw InvalidArgumentException::fromInvalidDelegatorFactoryClass($delegatorFactory);
            }
            throw InvalidArgumentException::fromInvalidDelegatorFactoryInstance($delegatorFactory);
        }

        //cache the callback for later requests
        $this->delegatorCallbackCache[$name] = $creationCallback;
        return $creationCallback($this->creationContext, $name, $creationCallback, $options);
    }
309380
public function getServer($name, $default = null)
    {
        return isset($this->servers[$name]) ? $this->servers[$name] : $default;
    }
1347824
protected function getService($name)
	{
		if (!isset($this->container[$name])) {
			throw new \Exception(sprintf('There is no service (connection or entity manager) with id "%s"', $name));
		}

		return $this->container[$name];
	}
345046
public function get($name)
    {
        if ($this->cache->has($name)) {
            return $this->loader->load($this->cache->get($name));
        }

        if (!$this->cache->isFresh()) {
            $this->refresh();

            return $this->get($name);
        }

        throw new \InvalidArgumentException(sprintf(
            'Unknown resource named "%s" for the host "%s"',
            $name,
            $this->host
        ));
    }
1022586
public function createTeam($organizationUuid, $name)
    {
        $options = [
            'form_params' => [
                'name' => $name,
            ],
        ];

        return new OperationResponse(
            $this->connector->request('post', "/organizations/${organizationUuid}/teams", $this->query, $options)
        );
    }
1338077
public function getGitReposAsync($org_id = null, $name = null)
    {
        return $this->getGitReposAsyncWithHttpInfo($org_id, $name)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }
106138
public function server($name = null)
    {
        $value = $name === null ? $this->server : null;

        $server = (array) $this->server;

        isset($server[$name]) && $value = $server[$name];

        return $value;

        // getServerParams
    }
1320491
public function matchProcedure($name, $organizationId, $create = true)
    {
        $cacheId = __CLASS__ . '_' . __FUNCTION__;
        $matches = $this->cache->load($cacheId);

        if (! $matches) {
            $matches = array();
            $select  = $this->db->select();
            $select->from('gems__agenda_procedures', array(
                'gapr_id_procedure', 'gapr_match_to', 'gapr_id_organization', 'gapr_filter',
                ));

            $result = $this->db->fetchAll($select);
            foreach ($result as $row) {
                if (null === $row['gapr_id_organization']) {
                    $key = 'null';
                } else {
                    $key = $row['gapr_id_organization'];
                }
                foreach (explode('|', $row['gapr_match_to']) as $match) {
                    $matches[$match][$key] = $row['gapr_filter'] ? false : $row['gapr_id_procedure'];
                }
            }
            $this->cache->save($matches, $cacheId, array('procedures'));
        }

        if (isset($matches[$name])) {
            if (isset($matches[$name][$organizationId])) {
                return $matches[$name][$organizationId];
            }
            if (isset($matches[$name]['null'])) {
                return $matches[$name]['null'];
            }
        }

        if (! $create) {
            return null;
        }

        $result = $this->addProcedure($name, $organizationId);

        return $result['gapr_filter'] ? false : $result['gapr_id_procedure'];
    }
1158634
public function serverGroupCreate($name, $type = Teamspeak::GROUP_DBTYPE_REGULAR)
    {
        $this->serverGroupListReset();

        $sgid = $this->execute("servergroupadd", array("name" => $name, "type" => $type))->toList();

        return $sgid["sgid"];
    }
278142
public function getOAuthParameter($name)
    {
        if (!$this->hasOAuthParameter($name)) {
            throw new \InvalidArgumentException(sprintf('The OAuth request parameter "%s" does not exist.', $name));
        }

        return $this->oauthParameters[rawurlencode($name)];
    }
1153071
public function get($name)
    {
        $name = strtoupper($name);
        if (isset($_SERVER[$name])) {
            return $_SERVER[$name];
        }
        return null;
    }
1144886
public function getServerParam($name)
    {
        $name = strtoupper($name);

        return isset($this->server[$name]) ? $this->server[$name] : false;
    }
1304718
public static function get($name, $key = 'main')
    {
        if (in_array($name, ['sql', 'redis', 'elastic'])) {
            $resource = cradle('global')->service($name . '-' . $key);

            if ($resource) {
                if ($name === 'sql') {
                    return new SqlService($resource);
                }

                if ($name === 'redis') {
                    return new RedisService($resource);
                }

                if ($name === 'elastic') {
                    return new ElasticService($resource);
                }
            }
        }

        return new NoopService();
    }