Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@

- Drop support for PHP `8.1`
- Requires `innmind/foundation:^1.7.1`
- The following methods now return an `Innmind\Immutable\Attempt<Innmind\Immutable\SideEffect>`:
- `Innmind\RabbitMQ\Management\Control\Permissions::declare()`
- `Innmind\RabbitMQ\Management\Control\Permissions::delete()`
- `Innmind\RabbitMQ\Management\Control\Users::declare()`
- `Innmind\RabbitMQ\Management\Control\Users::delete()`
- `Innmind\RabbitMQ\Management\Control\VHosts::declare()`
- `Innmind\RabbitMQ\Management\Control\VHosts::delete()`

### Fixed

Expand Down
20 changes: 11 additions & 9 deletions src/Control/Permissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Server\Command,
};
use Innmind\Immutable\{
Maybe,
Attempt,
SideEffect,
};

Expand All @@ -29,15 +29,15 @@ public static function of(Server $server): self
}

/**
* @return Maybe<SideEffect>
* @return Attempt<SideEffect>
*/
public function declare(
string $vhost,
string $user,
string $configure,
string $write,
string $read,
): Maybe {
): Attempt {
return $this
->server
->processes()
Expand All @@ -52,15 +52,16 @@ public function declare(
->withArgument('write='.$write)
->withArgument('read='.$read),
)
->maybe()
->flatMap(static fn($process) => $process->wait()->maybe())
->flatMap(static fn($process) => $process->wait()->attempt(
static fn($error) => new \RuntimeException($error::class),
))
->map(static fn() => new SideEffect);
}

/**
* @return Maybe<SideEffect>
* @return Attempt<SideEffect>
*/
public function delete(string $vhost, string $user): Maybe
public function delete(string $vhost, string $user): Attempt
{
return $this
->server
Expand All @@ -73,8 +74,9 @@ public function delete(string $vhost, string $user): Maybe
->withArgument('vhost='.$vhost)
->withArgument('user='.$user),
)
->maybe()
->flatMap(static fn($process) => $process->wait()->maybe())
->flatMap(static fn($process) => $process->wait()->attempt(
static fn($error) => new \RuntimeException($error::class),
))
->map(static fn() => new SideEffect);
}
}
20 changes: 11 additions & 9 deletions src/Control/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Server\Command,
};
use Innmind\Immutable\{
Maybe,
Attempt,
SideEffect,
};

Expand All @@ -29,9 +29,9 @@ public static function of(Server $server): self
}

/**
* @return Maybe<SideEffect>
* @return Attempt<SideEffect>
*/
public function declare(string $name, string $password, string ...$tags): Maybe
public function declare(string $name, string $password, string ...$tags): Attempt
{
return $this
->server
Expand All @@ -45,15 +45,16 @@ public function declare(string $name, string $password, string ...$tags): Maybe
->withArgument('password='.$password)
->withArgument('tags='.\implode(',', $tags)),
)
->maybe()
->flatMap(static fn($process) => $process->wait()->maybe())
->flatMap(static fn($process) => $process->wait()->attempt(
static fn($error) => new \RuntimeException($error::class),
))
->map(static fn() => new SideEffect);
}

/**
* @return Maybe<SideEffect>
* @return Attempt<SideEffect>
*/
public function delete(string $name): Maybe
public function delete(string $name): Attempt
{
return $this
->server
Expand All @@ -65,8 +66,9 @@ public function delete(string $name): Maybe
->withArgument('user')
->withArgument('name='.$name),
)
->maybe()
->flatMap(static fn($process) => $process->wait()->maybe())
->flatMap(static fn($process) => $process->wait()->attempt(
static fn($error) => new \RuntimeException($error::class),
))
->map(static fn() => new SideEffect);
}
}
20 changes: 11 additions & 9 deletions src/Control/VHosts.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Server\Command,
};
use Innmind\Immutable\{
Maybe,
Attempt,
SideEffect,
};

Expand All @@ -29,9 +29,9 @@ public static function of(Server $server): self
}

/**
* @return Maybe<SideEffect>
* @return Attempt<SideEffect>
*/
public function declare(string $name): Maybe
public function declare(string $name): Attempt
{
return $this
->server
Expand All @@ -43,15 +43,16 @@ public function declare(string $name): Maybe
->withArgument('vhost')
->withArgument('name='.$name),
)
->maybe()
->flatMap(static fn($process) => $process->wait()->maybe())
->flatMap(static fn($process) => $process->wait()->attempt(
static fn($error) => new \RuntimeException($error::class),
))
->map(static fn() => new SideEffect);
}

/**
* @return Maybe<SideEffect>
* @return Attempt<SideEffect>
*/
public function delete(string $name): Maybe
public function delete(string $name): Attempt
{
return $this
->server
Expand All @@ -63,8 +64,9 @@ public function delete(string $name): Maybe
->withArgument('vhost')
->withArgument('name='.$name),
)
->maybe()
->flatMap(static fn($process) => $process->wait()->maybe())
->flatMap(static fn($process) => $process->wait()->attempt(
static fn($error) => new \RuntimeException($error::class),
))
->map(static fn() => new SideEffect);
}
}
Loading
Loading