|
93 | 93 | }) |
94 | 94 | ); |
95 | 95 |
|
| 96 | +// Create auth-api-implicit Command. |
| 97 | +$application->add((new Command('auth-api-implicit')) |
| 98 | + ->addArgument('projectId', InputArgument::REQUIRED, 'Your project ID') |
| 99 | + ->setDescription('Authenticate to a cloud API using a service account implicitly.') |
| 100 | + ->setHelp(<<<EOF |
| 101 | +The <info>%command.name%</info> command authenticates to a cloud API using a |
| 102 | +service account implicitly. |
| 103 | +
|
| 104 | + <info>php %command.full_name%</info> |
| 105 | +
|
| 106 | +EOF |
| 107 | + ) |
| 108 | + ->setCode(function ($input, $output) { |
| 109 | + auth_api_implicit($input->getArgument('projectId')); |
| 110 | + }) |
| 111 | +); |
| 112 | + |
| 113 | +// Create auth-api-explicit Command. |
| 114 | +$application->add((new Command('auth-api-explicit')) |
| 115 | + ->addArgument('projectId', InputArgument::REQUIRED, 'Your project ID') |
| 116 | + ->addArgument('serviceAccountPath', InputArgument::REQUIRED, 'Path to your service account.') |
| 117 | + ->setDescription('Authenticate to a cloud API using a service account explicitly.') |
| 118 | + ->setHelp(<<<EOF |
| 119 | +The <info>%command.name%</info> command authenticates to a cloud API using a |
| 120 | +service account implicitly. |
| 121 | +
|
| 122 | + <info>php %command.full_name%</info> |
| 123 | +
|
| 124 | +EOF |
| 125 | + ) |
| 126 | + ->setCode(function ($input, $output) { |
| 127 | + $projectId = $input->getArgument('projectId'); |
| 128 | + $serviceAccountPath = $input->getArgument('serviceAccountPath'); |
| 129 | + auth_api_explicit($projectId, $serviceAccountPath); |
| 130 | + }) |
| 131 | +); |
| 132 | + |
| 133 | +// Create auth-api-explicit-compute-engine Command. |
| 134 | +$application->add((new Command('auth-api-explicit-compute-engine')) |
| 135 | + ->addArgument('projectId', InputArgument::REQUIRED, 'Your project ID') |
| 136 | + ->setDescription('Authenticate to a cloud API using Compute Engine credentials explicitly.') |
| 137 | + ->setHelp(<<<EOF |
| 138 | +The <info>%command.name%</info> command authenticates to a cloud API using |
| 139 | +Compute Engine credentials explicitly. |
| 140 | +
|
| 141 | + <info>php %command.full_name%</info> |
| 142 | +
|
| 143 | +EOF |
| 144 | + ) |
| 145 | + ->setCode(function ($input, $output) { |
| 146 | + $projectId = $input->getArgument('projectId'); |
| 147 | + auth_api_explicit_compute_engine($projectId); |
| 148 | + }) |
| 149 | +); |
| 150 | + |
| 151 | +// Create auth-api-explicit-app-engine Command. |
| 152 | +$application->add((new Command('auth-api-explicit-app-engine')) |
| 153 | + ->addArgument('projectId', InputArgument::REQUIRED, 'Your project ID') |
| 154 | + ->setDescription('Authenticate to a cloud API using App Engine Standard credentials explicitly.') |
| 155 | + ->setHelp(<<<EOF |
| 156 | +The <info>%command.name%</info> command authenticates to a cloud API using |
| 157 | +Compute Engine credentials explicitly. |
| 158 | +
|
| 159 | + <info>php %command.full_name%</info> |
| 160 | +
|
| 161 | +EOF |
| 162 | + ) |
| 163 | + ->setCode(function ($input, $output) { |
| 164 | + $projectId = $input->getArgument('projectId'); |
| 165 | + auth_api_explicit_compute_engine($projectId); |
| 166 | + }) |
| 167 | +); |
| 168 | + |
96 | 169 | if (getenv('PHPUNIT_TESTS') === '1') { |
97 | 170 | return $application; |
98 | 171 | } |
|
0 commit comments