PHP 클래스 Google\Cloud\Compute\Metadata

The metadata is available from Google Compute Engine instances and App Engine Managed VMs instances. You can get the GCE metadata values very easily like: use Google\Cloud\Compute\Metadata; $metadata = new Metadata(); $project_id = $metadata->getProjectId(); $val = $metadata->getProjectMetadata($key);
파일 보기 프로젝트 열기: GoogleCloudPlatform/gcloud-php

공개 메소드들

메소드 설명
__construct ( ) We use StreamReader for the default implementation for fetching the URL.
get ( string $path ) Fetch a metadata item by its path
getInstanceMetadata ( string $key ) : string Fetch an item from the instance metadata
getProjectId ( ) : string Detect and return the project ID
getProjectMetadata ( string $key ) : string Fetch an item from the project metadata
setReader ( mixed $reader ) Replace the default reader implementation

메소드 상세

__construct() 공개 메소드

We use StreamReader for the default implementation for fetching the URL.
public __construct ( )

get() 공개 메소드

Example: $projectId = $reader->get('project/project-id');
public get ( string $path )
$path string The path of the item to retrieve.

getInstanceMetadata() 공개 메소드

Example: $foo = $reader->getInstanceMetadata('foo');
public getInstanceMetadata ( string $key ) : string
$key string The instance metadata key
리턴 string

getProjectId() 공개 메소드

Example: $projectId = $reader->getProjectId();
public getProjectId ( ) : string
리턴 string

getProjectMetadata() 공개 메소드

Example: $foo = $reader->getProjectMetadata('foo');
public getProjectMetadata ( string $key ) : string
$key string The metadata key
리턴 string

setReader() 공개 메소드

Replace the default reader implementation
public setReader ( mixed $reader )
$reader mixed The reader implementation