PHP 클래스 Acquia\CloudApi\Client\CloudApi

This object provides sensible method signatures for almost all of the cloudapi calls. The only one that is missing at this point is the one that installs a drupal distro. I can't see that being relevant to our work, and actually could be quite dangerous. Configuration: This class is meant to be used from the gardener. The other sites in gardens will not have the appropriate credentials. Example: $api = New CloudApi() print_r($api->listDatabases('tangle001', 'prod'));
파일 보기 프로젝트 열기: acquia/cloudapi-php-client

보호된 프로퍼티들

프로퍼티 타입 설명
$allCreds
$cainfo
$default_options

공개 메소드들

메소드 설명
__sleep ( ) This class is not serializable.
addDatabase ( $site, $db, $cluster_map = NULL ) Add a database
addDomain ( $site, $env, $domain ) Add a domain name.
addSSHKey ( $site, $nickname, $ssh_pub_key ) Add an SSH key
addSVNUser ( $site, $username, $password ) Add an SVN user
backupDatabase ( $site, $env, $db ) Create a database instance backup.
copyDatabase ( $site, $db, $source, $target ) Copy a database from one site environment to another
copyFiles ( $site, $source, $target ) Copy files from one site environment to another.
deleteDatabase ( $site, $db, $backup = 1 ) Delete a database
deleteDatabaseBackup ( $site, $env, $db, $backup ) Delete a site environment database instance backup.
deleteDomain ( $site, $env, $domain ) Delete a domain.
deleteSSHKey ( $site, $sshkeyid ) Delete an SSH key.
deleteSVNUser ( $site, $sshuserid ) Delete an SVN user
deployCode ( $site, $source, $target ) Deploy code from one site environment to another.
deployCodePath ( $site, $env, $path ) Deploy a specific VCS branch or tag to an environment.
getAllSiteNames ( ) Returns the set of all site names from the credentials file.
getDatabaseBackupInfo ( $site, $env, $db, $backup ) Get details about a database instance backup.
getDatabaseBackupLocation ( $site, $env, $db, $backup ) Get the location from which a backup can be downloaded.
getDatabaseClusterMap ( $site, $envs = NULL ) Returns an array of suitable database clusters for each environment.
getDatabaseInfo ( $site, $env, $db ) Get a database instance.
getDomainInfo ( $site, $env, $domain ) Get a domain record.
getEnvironmentInfo ( $site, $env ) Gets an environment record.
getInstance ( $site_name = NULL, $stage = NULL, $creds_filename = NULL ) : CloudApi Returns an instance of CloudApi, reusing a previous one if available.
getSSHKey ( $site, $sshkeyid ) Get an SSH key
getSVNUser ( $site, $svnuserid ) Get an SVN user.
getServerInfo ( $site, $env, $server ) Get a server record.
getSiteName ( {String} $site ) Returns the site name.
getSiteRecord ( $site ) Gets a site record.
getStage ( ) Returns the stage this CloudApi instance is configured to communicate with.
getTaskInfo ( $site, $task ) Get a task record.
getTasks ( $site ) List a site's tasks.
installEnvironment ( $site, $env, $type, $source ) Installs a drupal distro.
listDatabaseBackups ( $site, $env, $db ) List a site environment's database instance backups.
listDatabases ( $site, $env ) List a site environment's database instances.
listDomains ( $site, $env ) List the environment's domains.
listEnvironments ( $site ) List a site's environments.
listSSHKeys ( $site ) List a site's SSH keys.
listSVNUsers ( $site ) List a site's SVN users.
listServers ( $site, $env ) List a site environment's servers.
listSites ( $site ) Lists all sites accessible by the caller.
moveAllDomains ( string $sitegroup, string $from_env, string $to_env, boolean $skip_site_update = TRUE ) : array Moves all domains on a site atomically from one environment to another.
moveDomains ( string | array $domains, string $sitegroup, string $from_env, string $to_env, boolean $skip_site_update = TRUE ) Moves domains atomically from one environment to another.
purgeVarnish ( $site, $env, $domain ) Purge the Varnish cache for a domain.
restoreDatabase ( $site, $env, $db, $backup ) Restore a site environment database instance backup.
setCaInfo ( $path ) Set the path to a CA file for curl.
setDefaultCallOption ( $key, $value ) Set a default option for the callAcapi() method.

비공개 메소드들

메소드 설명
__construct ( $site_name, $stage = NULL, $creds_filename = NULL ) Constructor.
callAcapi ( $site, $method, $resource, $params = [], $body = [], $options = [] ) Call an Acquia Cloud API resource.
getCreds ( {mixed} $site ) Returns the credentials for the specified site.

메소드 상세

__sleep() 공개 메소드

Because CloudApi credentials are cached as part of this object, serializing it will provide those credentials in clear text.
public __sleep ( )

addDatabase() 공개 메소드

Add a database
public addDatabase ( $site, $db, $cluster_map = NULL )
$site the site name (ex: tangle001, gardener, etc.)
$db the database name
$cluster_map a mapping containing all environments and the cluster to which the associated database should be created. (See getDatabaseClusterMap). Note that if more than one cluster is associated with a sitegroup, this map is required.

addDomain() 공개 메소드

Add a domain name.
public addDomain ( $site, $env, $domain )
$site the site name (ex: tangle001, gardener, etc.)
$env the environment name
$domain the domain name to add

addSSHKey() 공개 메소드

Add an SSH key
public addSSHKey ( $site, $nickname, $ssh_pub_key )
$site the site name (ex: tangle001, gardener, etc.)
$nickname key nickname
$ssh_pub_key SSH public key

addSVNUser() 공개 메소드

Add an SVN user
public addSVNUser ( $site, $username, $password )
$site the site name (ex: tangle001, gardener, etc.)
$password user svn password

backupDatabase() 공개 메소드

Create a database instance backup.
public backupDatabase ( $site, $env, $db )
$site the site name (ex: tangle001, gardener, etc.)
$env the environment name
$db the database name

copyDatabase() 공개 메소드

Copy a database from one site environment to another
public copyDatabase ( $site, $db, $source, $target )
$site the site name (ex: tangle001, gardener, etc.)
$db the database name
$source the source environment name
$target the target environment name

copyFiles() 공개 메소드

Copy files from one site environment to another.
public copyFiles ( $site, $source, $target )
$site the site name (ex: tangle001, gardener, etc.)
$source the source environment name
$target the target environment name

deleteDatabase() 공개 메소드

Delete a database
public deleteDatabase ( $site, $db, $backup = 1 )
$site the site name (ex: tangle001, gardener, etc.)
$db the database name
$backup a final backup of the database instance in each environment is made before deletion unless this query parameter has value 0.

deleteDatabaseBackup() 공개 메소드

Delete a site environment database instance backup.
public deleteDatabaseBackup ( $site, $env, $db, $backup )
$site the site name (ex: tangle001, gardener, etc.)
$env the environment name (ex: prod, dev)
$db the database name
$backup the backup id

deleteDomain() 공개 메소드

Delete a domain.
public deleteDomain ( $site, $env, $domain )
$site the site name (ex: tangle001, gardener, etc.)
$env the environment name (ex: prod, dev)
$domain the domain name to delete

deleteSSHKey() 공개 메소드

Delete an SSH key.
public deleteSSHKey ( $site, $sshkeyid )
$site the site name (ex: tangle001, gardener, etc.)
$sshkeyid Key id

deleteSVNUser() 공개 메소드

Delete an SVN user
public deleteSVNUser ( $site, $sshuserid )
$site the site name (ex: tangle001, gardener, etc.)

deployCode() 공개 메소드

Deploy code from one site environment to another.
public deployCode ( $site, $source, $target )
$site the site name (ex: tangle001, gardener, etc.)
$source the source environment name
$target the target environment name

deployCodePath() 공개 메소드

Deploy a specific VCS branch or tag to an environment.
public deployCodePath ( $site, $env, $path )
$site the site name (ex: tangle001, gardener, etc.)
$env the environment name
$path the name of the branch or tag (e.g. master or tags/tagname)

getAllSiteNames() 공개 메소드

Returns the set of all site names from the credentials file.
public getAllSiteNames ( )

getDatabaseBackupInfo() 공개 메소드

Get details about a database instance backup.
public getDatabaseBackupInfo ( $site, $env, $db, $backup )
$site the site name (ex: tangle001, gardener, etc.)
$env the environment name (ex: prod, dev)
$db the database name (ex: 'g76')
$backup the backup id (ex: 217005)

getDatabaseBackupLocation() 공개 메소드

Get the location from which a backup can be downloaded.
public getDatabaseBackupLocation ( $site, $env, $db, $backup )
$site the site name (ex: tangle001, gardener, etc.)
$env the environment name (ex: prod, dev)
$db the database name (ex: 'g76')
$backup the backup id (ex: 217005)

getDatabaseClusterMap() 공개 메소드

This array structure is meant to be passed into the addDatabase method and provides a suitable database cluster for each environment of the specified site. When adding a database, a new database will be added to each environment, and if an attempt is made to add a database to an environment on a cluster that is not associated with that environment the addDatabase call will create a task that will fail. Getting the array from this method guarantees that each environment will have a suitable cluster_id. Any desired modifications can be made and then the database add should work correctly.
public getDatabaseClusterMap ( $site, $envs = NULL )
$site the site name (ex: tangle001, gardener, etc.)
$envs The environment list (from listEnvironments). If not provided the environments will be retrieved.

getDatabaseInfo() 공개 메소드

Get a database instance.
public getDatabaseInfo ( $site, $env, $db )
$site the site name (ex: tangle001, gardener, etc.)
$env the environment name (ex: prod, dev)
$db the database name (ex: 'g76')

getDomainInfo() 공개 메소드

Get a domain record.
public getDomainInfo ( $site, $env, $domain )
$site the site name (ex: tangle001, gardener, etc.)
$env the environment name (ex: prod, dev)
$domain the domain name (ex: bar.com)

getEnvironmentInfo() 공개 메소드

Gets an environment record.
public getEnvironmentInfo ( $site, $env )
$site the site name (ex: tangle001, gardener, etc.)
$env the environment name (ex: prod, dev)

getInstance() 공개 정적인 메소드

Returns an instance of CloudApi, reusing a previous one if available.
public static getInstance ( $site_name = NULL, $stage = NULL, $creds_filename = NULL ) : CloudApi
$site_name The name of the site for which credentials should be used.
$stage Optional. If provided a file with the suffix matching the stage will be used rather than the default cloudapi.ini file.
리턴 CloudApi An instance of the CloudApi class.

getSSHKey() 공개 메소드

Get an SSH key
public getSSHKey ( $site, $sshkeyid )
$site the site name (ex: tangle001, gardener, etc.)
$sshkeyid SSH key id

getSVNUser() 공개 메소드

Get an SVN user.
public getSVNUser ( $site, $svnuserid )
$site the site name (ex: tangle001, gardener, etc.)
$svnuserid SVN user id

getServerInfo() 공개 메소드

Get a server record.
public getServerInfo ( $site, $env, $server )
$site the site name (ex: tangle001, gardener, etc.)
$env the environment name (ex: prod, dev)
$server the server name

getSiteName() 공개 메소드

This method allows us to do aliases in the credential files. For example we could have an entry: gardener=gardener-utest which would allow us to refer to the site as gardener in our code, and would be resolved to the correct name via the credentials file.
public getSiteName ( {String} $site )
$site {String}

getSiteRecord() 공개 메소드

Gets a site record.
public getSiteRecord ( $site )
$site the site name (ex: tangle001, gardener, etc.)

getStage() 공개 메소드

Returns the stage this CloudApi instance is configured to communicate with.
public getStage ( )

getTaskInfo() 공개 메소드

Get a task record.
public getTaskInfo ( $site, $task )
$site the site name (ex: tangle001, gardener, etc.)
$task the task id

getTasks() 공개 메소드

List a site's tasks.
public getTasks ( $site )
$site the site name (ex: tangle001, gardener, etc.)

installEnvironment() 공개 메소드

Seriously, don't call this. It will throw an exception.
public installEnvironment ( $site, $env, $type, $source )
$site the site name (ex: tangle001, gardener, etc.)
$env the environment name (ex: prod, dev)
$type the type of distro source. ex: 'distro_name', 'distro_url', 'make_url'
$source a distro name, URL to a distro, or URL to a Drush make file.

listDatabaseBackups() 공개 메소드

List a site environment's database instance backups.
public listDatabaseBackups ( $site, $env, $db )
$site the site name (ex: tangle001, gardener, etc.)
$env the environment name (ex: prod, dev)
$db the database name (ex: 'g76')

listDatabases() 공개 메소드

List a site environment's database instances.
public listDatabases ( $site, $env )
$site the site name (ex: tangle001, gardener, etc.)
$env the environment name (ex: prod, dev)

listDomains() 공개 메소드

List the environment's domains.
public listDomains ( $site, $env )
$site the site name (ex: tangle001, gardener, etc.)
$env the environment name (ex: prod, dev)

listEnvironments() 공개 메소드

List a site's environments.
public listEnvironments ( $site )
$site the site name (ex: tangle001, gardener, etc.)

listSSHKeys() 공개 메소드

List a site's SSH keys.
public listSSHKeys ( $site )
$site the site name (ex: tangle001, gardener, etc.)

listSVNUsers() 공개 메소드

List a site's SVN users.
public listSVNUsers ( $site )
$site the site name (ex: tangle001, gardener, etc.)

listServers() 공개 메소드

List a site environment's servers.
public listServers ( $site, $env )
$site the site name (ex: tangle001, gardener, etc.)
$env the environment name (ex: prod, dev)

listSites() 공개 메소드

Lists all sites accessible by the caller.
public listSites ( $site )
$site the site name (ex: tangle001, gardener, etc.)

moveAllDomains() 공개 메소드

This is just a special case of moveDomain, using the wildcard as domain.
public moveAllDomains ( string $sitegroup, string $from_env, string $to_env, boolean $skip_site_update = TRUE ) : array
$sitegroup string The hosting sitegroup name.
$from_env string The hosting environment to take domains from.
$to_env string The hosting environment to move domains to.
$skip_site_update boolean If set to TRUE (default), this will inhibit running fields-config-web.php for this domain move.
리턴 array The task record for moving the domains.

moveDomains() 공개 메소드

Moves domains atomically from one environment to another.
public moveDomains ( string | array $domains, string $sitegroup, string $from_env, string $to_env, boolean $skip_site_update = TRUE )
$domains string | array The domain name(s) as an array of strings, or the string '*' to move all domains.
$sitegroup string The hosting sitegroup name.
$from_env string The environment which currently has this domain.
$to_env string The destination environment for the domain.
$skip_site_update boolean If set to TRUE (default), this will inhibit running fields-config-web.php for this domain move.

purgeVarnish() 공개 메소드

Purge the Varnish cache for a domain.
public purgeVarnish ( $site, $env, $domain )
$site the site name (ex: tangle001, gardener, etc.)
$env the environment name (ex: prod, dev)
$domain the domain name to delete

restoreDatabase() 공개 메소드

Restore a site environment database instance backup.
public restoreDatabase ( $site, $env, $db, $backup )
$site the site name (ex: tangle001, gardener, etc.)
$env the environment name
$db the database name
$backup the backup id

setCaInfo() 공개 메소드

This is mostly useful when using a crufty version of PHP for development and the provided CA file is outdated. You can get an updated one from http://curl.haxx.se/docs/caextract.html
public setCaInfo ( $path )
$path The path to a CA PEM file.

setDefaultCallOption() 공개 메소드

Set a default option for the callAcapi() method.
public setDefaultCallOption ( $key, $value )
$key String key.
$value mixed value.

프로퍼티 상세

$allCreds 보호되어 있는 정적으로 프로퍼티

protected static $allCreds

$cainfo 보호되어 있는 프로퍼티

protected $cainfo

$default_options 보호되어 있는 프로퍼티

protected $default_options