Skip to content

Commit

Permalink
fix: payment cli (#142)
Browse files Browse the repository at this point in the history
* fix: tier names

* fix: tier names in cli

* fix: tier case sensitive

* feat: add payment amount

* chore: lint
  • Loading branch information
dtdang authored Oct 18, 2024
1 parent 3619530 commit bfba34b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions silverback/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,15 +309,16 @@ def pay():
@click.option(
"-t",
"--tier",
default=ClusterTier.PERSONAL.name.capitalize(),
default=ClusterTier.STANDARD.name.capitalize(),
metavar="NAME",
type=click.Choice(
[
ClusterTier.PERSONAL.name.capitalize(),
ClusterTier.PROFESSIONAL.name.capitalize(),
]
ClusterTier.STANDARD.name.capitalize(),
ClusterTier.PREMIUM.name.capitalize(),
],
case_sensitive=False,
),
help="Named set of options to use for cluster as a base (Defaults to Personal)",
help="Named set of options to use for cluster as a base (Defaults to Standard)",
)
@click.option(
"-c",
Expand Down Expand Up @@ -420,7 +421,8 @@ def create_payment_stream(
assert token_amount # mypy happy

click.echo(yaml.safe_dump(dict(configuration=configuration.settings_display_dict())))
click.echo(f"duration: {stream_time}\n")
click.echo(f"duration: {stream_time}")
click.echo(f"payment: {token_amount / (10 ** token.decimals())} {token.symbol()}\n")

if not click.confirm(
f"Do you want to use this configuration to fund Cluster '{cluster_path}'?"
Expand Down
4 changes: 2 additions & 2 deletions silverback/cluster/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,15 @@ def validate_product_code(
class ClusterTier(enum.IntEnum):
"""Suggestions for different tier configurations"""

PERSONAL = ClusterConfiguration(
STANDARD = ClusterConfiguration(
cpu="0.25 vCPU",
memory="512 MiB",
networks=3,
bots=5,
bandwidth="512 B/sec", # 1.236 GB/mo
duration=3, # months
).encode()
PROFESSIONAL = ClusterConfiguration(
PREMIUM = ClusterConfiguration(
cpu="1 vCPU",
memory="2 GB",
networks=10,
Expand Down

0 comments on commit bfba34b

Please sign in to comment.