Skip to content

Commit

Permalink
Merge pull request #14 from mittwald/dependabot/composer/mittwald/api…
Browse files Browse the repository at this point in the history
…-client-1.0.30

Bump mittwald/api-client from 1.0.29 to 1.0.30
  • Loading branch information
martin-helmich authored Nov 16, 2023
2 parents bc0deca + c81a017 commit d7f5ee1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
16 changes: 8 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 13 additions & 14 deletions src/Recipes/DomainRecipe.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
namespace Mittwald\Deployer\Recipes;

use Mittwald\ApiClient\Client\EmptyResponse;
use Mittwald\ApiClient\Generated\V2\Clients\Domain\IngressCreate\IngressCreate201Response;
use Mittwald\ApiClient\Generated\V2\Clients\Domain\IngressCreate\IngressCreateRequest;
use Mittwald\ApiClient\Generated\V2\Clients\Domain\IngressCreate\IngressCreateRequestBody;
use Mittwald\ApiClient\Generated\V2\Clients\Domain\IngressListForProject\IngressListForProject200Response;
use Mittwald\ApiClient\Generated\V2\Clients\Domain\IngressListForProject\IngressListForProjectRequest;
use Mittwald\ApiClient\Generated\V2\Clients\Domain\IngressPaths\IngressPathsRequest;
use Mittwald\ApiClient\Generated\V2\Clients\Domain\IngressCreateIngress\IngressCreateIngress201Response;
use Mittwald\ApiClient\Generated\V2\Clients\Domain\IngressCreateIngress\IngressCreateIngressRequest;
use Mittwald\ApiClient\Generated\V2\Clients\Domain\IngressCreateIngress\IngressCreateIngressRequestBody;
use Mittwald\ApiClient\Generated\V2\Clients\Domain\IngressListIngresses\IngressListIngresses200Response;
use Mittwald\ApiClient\Generated\V2\Clients\Domain\IngressListIngresses\IngressListIngressesRequest;
use Mittwald\ApiClient\Generated\V2\Clients\Domain\IngressUpdateIngressPaths\IngressUpdateIngressPathsRequest;
use Mittwald\ApiClient\Generated\V2\Schemas\Ingress\Path;
use Mittwald\ApiClient\Generated\V2\Schemas\Ingress\TargetInstallation;
use function Deployer\get;
use function Deployer\info;
use function Deployer\parse;
use function Deployer\set;
Expand Down Expand Up @@ -51,8 +50,8 @@ private static function assertVirtualHost(string $domain): void
$project = BaseRecipe::getProject();
$app = AppRecipe::getAppInstallation();

$virtualHostResponse = $client->ingressListForProject(new IngressListForProjectRequest($project->getId()));
if (!$virtualHostResponse instanceof IngressListForProject200Response) {
$virtualHostResponse = $client->ingressListIngresses((new IngressListIngressesRequest())->withProjectId($project->getId()));
if (!$virtualHostResponse instanceof IngressListIngresses200Response) {
throw new \Exception('could not list virtual hosts');
}

Expand All @@ -68,14 +67,14 @@ private static function assertVirtualHost(string $domain): void
if ($virtualHost === null) {
info("virtual host <fg=magenta;options=bold>{$domain}</> does not exist, creating it");

$request = new IngressCreateRequest((new IngressCreateRequestBody(
$request = new IngressCreateIngressRequest((new IngressCreateIngressRequestBody(
$domain,
[new Path($domainPathPrefix, new TargetInstallation($app->getId()))],
$project->getId(),
)));
$response = $client->ingressCreate($request);
$response = $client->ingressCreateIngress($request);

if (!$response instanceof IngressCreate201Response) {
if (!$response instanceof IngressCreateIngress201Response) {
throw new \Exception('could not create virtual host');
}
} else {
Expand Down Expand Up @@ -104,8 +103,8 @@ private static function assertVirtualHost(string $domain): void
if ($updateRequired) {
info("virtual host <fg=magenta;options=bold>{$domain}</> exists, updating it");

$request = new IngressPathsRequest($virtualHost->getId(), $updatedPaths);
$response = $client->ingressPaths($request);
$request = new IngressUpdateIngressPathsRequest($virtualHost->getId(), $updatedPaths);
$response = $client->ingressUpdateIngressPaths($request);

if (!$response instanceof EmptyResponse) {
throw new \Exception('could not update virtual host');
Expand Down

0 comments on commit d7f5ee1

Please sign in to comment.