class NewRelicRpmCommands in New Relic 2.0.x
Same name and namespace in other branches
- 8 src/Commands/NewRelicRpmCommands.php \Drupal\new_relic_rpm\Commands\NewRelicRpmCommands
- 2.x src/Commands/NewRelicRpmCommands.php \Drupal\new_relic_rpm\Commands\NewRelicRpmCommands
Corporate system drush commands.
Hierarchy
- class \Drupal\new_relic_rpm\Commands\NewRelicRpmCommands extends \Drush\Commands\DrushCommands
Expanded class hierarchy of NewRelicRpmCommands
1 string reference to 'NewRelicRpmCommands'
1 service uses NewRelicRpmCommands
File
- src/
Commands/ NewRelicRpmCommands.php, line 11
Namespace
Drupal\new_relic_rpm\CommandsView source
class NewRelicRpmCommands extends DrushCommands {
/**
* Newrelic API client.
*
* @var \Drupal\new_relic_rpm\Client\NewRelicApiClient
*/
protected $apiClient;
/**
* NewRelicRpmCommands constructor.
*
* @param \Drupal\new_relic_rpm\Client\NewRelicApiClient $api_client
* Newrelic API client.
*/
public function __construct(NewRelicApiClient $api_client) {
parent::__construct();
$this->apiClient = $api_client;
}
/**
* Mark a deployment in newrelic.
*
* @param string $revision
* The revision label.
* @param array $options
* The options to pass through to the deplopment.
*
* @command new-relic-rpm:deploy
* @aliases nrd
*
* @option description
* A brief description of the deployment.
* @option user
* User doing the deploy.
* @option changelog
* A list of changes for this deployment.
*
* @usage new-relic-rpm:deploy 1.2.3
* Create a deployment with revision 1.2.3.
* @usage new-relic-rpm:deploy 1.2.3 --description="New release".
* Create a deployment with revision 1.2.3 and a specific description.
*
* @validate-module-enabled new_relic_rpm
*/
public function deploy($revision, array $options = [
'description' => NULL,
'user' => NULL,
'changelog' => NULL,
]) {
$deployment = $this->apiClient
->createDeployment($revision, $options['description'], $options['user'], $options['changelog']);
if ($deployment) {
$this
->output()
->writeln('New Relic deployment created successfully.');
}
else {
$this
->logger()
->error(dt('New Relic deployment failed.'));
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
NewRelicRpmCommands:: |
protected | property | Newrelic API client. | |
NewRelicRpmCommands:: |
public | function | Mark a deployment in newrelic. | |
NewRelicRpmCommands:: |
public | function | NewRelicRpmCommands constructor. |