Formats a string containing the fully-qualified path to represent
a instance resource.

@param string $project
@param string $location
@param string $instance

@return string The formatted instance resource.
@experimental
359031
public static function instanceName($project, $location, $instance)
    {
        return self::getInstanceNameTemplate()->render([
            'project' => $project,
            'location' => $location,
            'instance' => $instance,
        ]);
    }
704088
public static function datasetName($project, $location, $dataset)
    {
        return self::getDatasetNameTemplate()->render([
            'project' => $project,
            'location' => $location,
            'dataset' => $dataset,
        ]);
    }
1155351
public function downloadProject($project, $version, $type, $path = null)
    {
        $commandKey = str_replace(':', '.', $this->getName());

        $this->getIo()->comment(
            sprintf(
                $this->trans('commands.' . $commandKey . '.messages.downloading'),
                $project,
                $version
            )
        );

        try {
            $destination = $this->drupalApi->downloadProjectRelease(
                $project,
                $version
            );

            if (!$path) {
                $path = $this->getExtractPath($type);
            }

            $projectPath = sprintf(
                '%s/%s',
                $this->appRoot,
                $path
            );

            if (!file_exists($projectPath)) {
                if (!mkdir($projectPath, 0777, true)) {
                    $this->getIo()->error(
                        sprintf(
                            $this->trans('commands.'.$commandKey.'.messages.error-creating-folder'),
                            $projectPath
                        )
                    );
                    return null;
                }
            }

            $zippy = Zippy::load();
            if (PHP_OS === 'WIN32' || PHP_OS === 'WINNT') {
                $container = AdapterContainer::load();
                $container['Drupal\\Console\\Zippy\\Adapter\\TarGzGNUTarForWindowsAdapter'] = function ($container) {
                    return TarGzGNUTarForWindowsAdapter::newInstance(
                        $container['executable-finder'],
                        $container['resource-manager'],
                        $container['gnu-tar.inflator'],
                        $container['gnu-tar.deflator']
                    );
                };
                $zippy->addStrategy(new TarGzFileForWindowsStrategy($container));
            }
            $archive = $zippy->open($destination);
            if ($type == 'core') {
                $archive->extract(getenv('MSYSTEM') ? null : $projectPath);
            } elseif (getenv('MSYSTEM')) {
                $current_dir = getcwd();
                $temp_dir = sys_get_temp_dir();
                chdir($temp_dir);
                $archive->extract();
                $fileSystem = new Filesystem();
                $fileSystem->rename($temp_dir . '/' . $project, $projectPath . '/' . $project);
                chdir($current_dir);
            } else {
                $archive->extract($projectPath);
            }

            unlink($destination);

            if ($type != 'core') {
                $this->getIo()->success(
                    sprintf(
                        $this->trans(
                            'commands.' . $commandKey . '.messages.downloaded'
                        ),
                        $project,
                        $version,
                        sprintf('%s/%s', $projectPath, $project)
                    )
                );
            }
        } catch (\Exception $e) {
            $this->getIo()->error($e->getMessage());

            return null;
        }

        return $projectPath;
    }
1269636
public function resolvePath (string $source, string $target) : string
    {
        $sourceDirs = $this->toDirectoryFragments(\dirname($source));
        $targetFileName = \basename($target);

        // if relative path is absolute, just return the absolute path
        if ("/" === \substr($target, 0, 1))
        {
            return $target;
        }

        // strip leading "./"
        if ("./" === \substr($target, 0, 2))
        {
            $target = \substr($target, 2);
        }

        $targetDirs = $this->toDirectoryFragments(\dirname($target));

        // if the relative dirs are empty (it is just a file name), use the same directory
        if (empty($targetDirs))
        {
            return $this->buildFilePath($sourceDirs, $targetFileName);
        }

        // strip leading "../../" from the beginning of the relative dir and simultaneously from the end of the source dir
        while (!empty($targetDirs) && ".." === $targetDirs[0])
        {
            \array_pop($sourceDirs);
            \array_shift($targetDirs);
        }

        return $this->buildFilePath(
            \array_merge($sourceDirs, $targetDirs),
            $targetFileName
        );
    }
431958
def session_path(cls, project, instance, database, session):
        """"""
        return google.api_core.path_template.expand(
            "projects/{project}/instances/{instance}/databases/{database}/sessions/{session}",
            project=project,
            instance=instance,
            database=database,
            session=session,
        )
1281704
public static function documentPathName($project, $database, $documentPath)
    {
        return self::getDocumentPathNameTemplate()->render([
            'project' => $project,
            'database' => $database,
            'document_path' => $documentPath,
        ]);
    }
742254
public static function snapshotName($project, $instance, $cluster, $snapshot)
    {
        return self::getSnapshotNameTemplate()->render([
            'project' => $project,
            'instance' => $instance,
            'cluster' => $cluster,
            'snapshot' => $snapshot,
        ]);
    }
457320
public static function databaseName($project, $instance, $database)
    {
        return self::getDatabaseNameTemplate()->render([
            'project' => $project,
            'instance' => $instance,
            'database' => $database,
        ]);
    }
16942
def _get_instance(project_id, instance_zone, name, service):
    '''
    
    '''
    return service.instances().get(project=project_id,
                                   zone=instance_zone,
                                   instance=name).execute()
144092
protected function fill($placeholder, $instance){
        switch( $placeholder ){
            case 'title':
                return get_the_title();
                break;
            case 'url':
                return get_permalink();
                break;
            case 'excerpt':
                return  get_the_excerpt();
                break;
            case 'date':
                return  get_the_date();
                break;
            case 'modified':
                return get_the_modified_date();
                break;
            case 'author':
                return get_the_author();
                break;
            default:
                return false;
                break;
        }
    }
24872
public static function anyPathName($project, $database, $document, $anyPath)
    {
        return self::getAnyPathNameTemplate()->render([
            'project' => $project,
            'database' => $database,
            'document' => $document,
            'any_path' => $anyPath,
        ]);
    }
717385
public function getEnvironmentPaths($project) {
		$baseDir = $this->getEnvironmentDir() . '/' . $project;

		$paths = array();
		if(!file_exists($baseDir)) {
			throw new Exception('Environment directory '.$baseDir.' doesn\'t exist. Create it first.');
		}
		// Search the directory for config files.
		foreach(scandir($baseDir) as $environmentFile) {
			if(preg_match('/\.rb$/', $environmentFile)) {
				// Config found, wrap it into an object.
				$paths[] = "$baseDir/$environmentFile";
			}
		}
		sort($paths);
		return array_values($paths);
	}
1097113
private function buildUri($endpoint, $path, array $query)
    {
        $queryString = '';
        if (count($query) > 0) {
            $queryString = '?'.urldecode(http_build_query($query));
        }

        return $endpoint.$path.$queryString;
    }
660792
public function generate($location)
    {
        if (!empty($location)) {
            @mkdir($location);

            if (substr($location, -1) != '/') {
                $location .= '/';
            }

            file_put_contents($location . 'composer.json', $this->generateJSON());
        } else {
            throw new \Exception('A location must be provided when generating a composer.json file');
        }
    }
961762
public static function build($location, $required, $description)
    {
        $param = new static();
        $param->location = $location;
        $param->required = $required;
        $param->description = $description;

        return $param;
    }
443932
def table_path(cls, project, instance, table):
        """"""
        return google.api_core.path_template.expand(
            "projects/{project}/instances/{instance}/tables/{table}",
            project=project,
            instance=instance,
            table=table,
        )
66003
public static function taskName($project, $location, $queue, $task)
    {
        return self::getTaskNameTemplate()->render([
            'project' => $project,
            'location' => $location,
            'queue' => $queue,
            'task' => $task,
        ]);
    }