/** * @param ScenarioAction $action * @param string $domain * @param string $projectName * @param int $scenarioId * @param int $actionId * @param null|string $accessToken * @return ScenarioAction */ public function editScenarioAction(ScenarioAction $action, $domain, $projectName, $scenarioId, $actionId, $accessToken = null) { return $this->patchJson($accessToken, ['local_path' => $action->getLocalPath(), 'remote_path' => $action->getRemotePath(), 'working_directory' => $action->getWorkingDirectory(), 'commands' => $action->getCommands(), 'bucket_name' => $action->getBucketName(), 'access_key' => $action->getAccessKey(), 'secret_key' => $action->getSecretKey(), 'public_access' => $action->getPublicAccess(), 'cloudfront_id' => $action->getCloudfrontId(), 'reduced_redundancy' => $action->getReducedRedundancy(), 'login' => $action->getLogin(), 'password' => $action->getPassword(), 'active_mode' => $action->getActiveMode(), 'host' => $action->getHost(), 'authentication_mode' => $action->getAuthenticationMode(), 'server_key' => $action->getServerKey(), 'passphrase' => $action->getPassphrase()], '/workspaces/:domain/projects/:project_name/release_scenarios/:release_scenario_id/actions/:action_id', ['domain' => $domain, 'project_name' => $projectName, 'release_scenario_id' => $scenarioId, 'action_id' => $actionId])->getAsScenarioAction(); }
public function editScenarioAction() { try { $buddy = new Buddy(['accessToken' => 'yourAccessToken']); $action = new ScenarioAction(); $action->setPort(33); $resp = $buddy->getApiScenarios()->editScenarioAction($action, 'domain', 'projectName', 1, 1); var_dump($resp); exit; } catch (BuddyResponseException $e) { echo $e->getMessage(); exit; } catch (BuddySDKException $e) { echo $e->getMessage(); exit; } }
public function testActionModel() { $name = Utils::randomString(); $accessKey = Utils::randomString(); $activeMode = true; $authMode = ScenarioAction::AUTH_MODE_PASS; $bucketName = Utils::randomString(); $cloudfrontId = Utils::randomString(); $commands = ['ls']; $host = 'http://google.pl'; $localPath = '/test'; $passphrase = Utils::randomString(); $password = Utils::randomString(); $login = Utils::randomString(); $port = Utils::randomInteger(); $publicAccess = true; $reducedRedundacy = true; $remotePath = '/var'; $secretKey = Utils::randomString(); $serverKey = Utils::randomString(); $type = ScenarioAction::TYPE_SFTP; $workingDir = '/home'; $action = new ScenarioAction(); $action->setName($name); $action->setAccessKey($accessKey); $action->setActiveMode($activeMode); $action->setAuthenticationMode($authMode); $action->setBucketName($bucketName); $action->setCloudfrontId($cloudfrontId); $action->setCommands($commands); $action->setHost($host); $action->setLocalPath($localPath); $action->setLogin($login); $action->setPassphrase($passphrase); $action->setPassword($password); $action->setPort($port); $action->setPublicAccess($publicAccess); $action->setReducedRedundancy($reducedRedundacy); $action->setRemotePath($remotePath); $action->setSecretKey($secretKey); $action->setServerKey($serverKey); $action->setType($type); $action->setWorkingDirectory($workingDir); $this->assertEquals($name, $action->getName()); $this->assertEquals($accessKey, $action->getAccessKey()); $this->assertEquals($activeMode, $action->getActiveMode()); $this->assertEquals($authMode, $action->getAuthenticationMode()); $this->assertEquals($bucketName, $action->getBucketName()); $this->assertEquals($cloudfrontId, $action->getCloudfrontId()); $this->assertEquals($commands, $action->getCommands()); $this->assertEquals($host, $action->getHost()); $this->assertEquals($localPath, $action->getLocalPath()); $this->assertEquals($login, $action->getLogin()); $this->assertEquals($passphrase, $action->getPassphrase()); $this->assertEquals($password, $action->getPassword()); $this->assertEquals($port, $action->getPort()); $this->assertEquals($publicAccess, $action->getPublicAccess()); $this->assertEquals($reducedRedundacy, $action->getReducedRedundancy()); $this->assertEquals($remotePath, $action->getRemotePath()); $this->assertEquals($secretKey, $action->getSecretKey()); $this->assertEquals($serverKey, $action->getServerKey()); $this->assertEquals($type, $action->getType()); $this->assertEquals($workingDir, $action->getWorkingDirectory()); $this->assertEmpty($action->getId()); $this->assertEmpty($action->getRevision()); $this->assertEmpty($action->getStatus()); }